IOStream initializes from a file-like object missing attributes.
(self)
| 64 | class TestIOStream(unittest.TestCase): |
| 65 | |
| 66 | def test_IOStream_init(self): |
| 67 | """IOStream initializes from a file-like object missing attributes. """ |
| 68 | # Cause a failure from getattr and dir(). (Issue #6386) |
| 69 | class BadStringIO(StringIO): |
| 70 | def __dir__(self): |
| 71 | attrs = super().__dir__() |
| 72 | attrs.append('name') |
| 73 | return attrs |
| 74 | with self.assertWarns(DeprecationWarning): |
| 75 | iostream = IOStream(BadStringIO()) |
| 76 | iostream.write('hi, bad iostream\n') |
| 77 | |
| 78 | assert not hasattr(iostream, 'name') |
| 79 | iostream.close() |
| 80 | |
| 81 | def test_capture_output(self): |
| 82 | """capture_output() context works""" |
nothing calls this directly
no test coverage detected