Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members.

This commit is contained in:
Christian Heimes 2008-10-30 21:23:35 +00:00
parent fec925b315
commit df32b3967c
2 changed files with 11 additions and 2 deletions

View file

@ -1237,6 +1237,13 @@ class MiscIOTest(unittest.TestCase):
else:
self.assert_(issubclass(obj, io.IOBase))
def test_fileio_warnings(self):
with support.check_warnings() as w:
self.assertEqual(w.warnings, [])
self.assertRaises(TypeError, io.FileIO, [])
self.assertEqual(w.warnings, [])
self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt")
self.assertEqual(w.warnings, [])
def test_main():
support.run_unittest(IOTest, BytesIOTest, StringIOTest,