def test_IOStream_init(): """IOStream initializes from a file-like object missing attributes. """ # Cause a failure from getattr and dir(). (Issue #6386) class BadStringIO(stdlib_io.StringIO): def __dir__(self): attrs = super(BadStringIO, self).__dir__() attrs.append('name') return attrs iostream = IOStream(BadStringIO()) iostream.write(u'hi, bad iostream\n') assert not hasattr(iostream, 'name')
def test_IOStream_init(): """IOStream initializes from a file-like object missing attributes. """ # Cause a failure from getattr and dir(). (Issue #6386) class BadStringIO(StringIO): def __dir__(self): attrs = super(StringIO, self).__dir__() attrs.append('name') return attrs iostream = IOStream(BadStringIO()) iostream.write('hi, bad iostream\n') assert not hasattr(iostream, 'name')
def test_IOStream_init(self): """IOStream initializes from a file-like object missing attributes. """ # Cause a failure from getattr and dir(). (Issue #6386) class BadStringIO(StringIO): def __dir__(self): attrs = super().__dir__() attrs.append("name") return attrs with self.assertWarns(DeprecationWarning): iostream = IOStream(BadStringIO()) iostream.write("hi, bad iostream\n") assert not hasattr(iostream, "name") iostream.close()