def test_safe(self):
        """
        Test that L{reporter.SafeStream} successfully write to its original
        stream even if an interrupt happens during the write.
        """
        stream = NativeStringIO()
        broken = BrokenStream(stream)
        safe = reporter.SafeStream(broken)
        safe.write("Hello")
        self.assertEqual(stream.getvalue(), "Hello")

        Test that L{reporter.SafeStream} successfully write to its original
        stream even if an interrupt happens during the write.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_reporter.py