def test_brokenStream(self):
        """
        Test that the reporter safely writes to its stream.
        """
        result = self.resultFactory(stream=BrokenStream(self.stream))
        result._writeln("Hello")
        self.assertEqual(self.stream.getvalue(), 'Hello\n')
        self.stream.truncate(0)
        self.stream.seek(0)
        result._writeln("Hello %s!", 'World')
        self.assertEqual(self.stream.getvalue(), 'Hello World!\n')

        Test that the reporter safely writes to its stream.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_reporter.py