| 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') |
no outgoing calls