diff options
author | Christian Heimes <christian@cheimes.de> | 2008-10-30 21:26:15 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-10-30 21:26:15 (GMT) |
commit | ab5f87902299fb92a2dbae356c853158881cd980 (patch) | |
tree | 1b97f39a2ada0bb8f326ae7096a3a7c7f03bfd91 /Lib | |
parent | 69a9c5b539dd848369efcd67574e447065f638e9 (diff) | |
download | cpython-ab5f87902299fb92a2dbae356c853158881cd980.zip cpython-ab5f87902299fb92a2dbae356c853158881cd980.tar.gz cpython-ab5f87902299fb92a2dbae356c853158881cd980.tar.bz2 |
Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_io.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 9ef2a81..08a524f 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1236,6 +1236,13 @@ class MiscIOTest(unittest.TestCase): else: self.assert_(issubclass(obj, io.IOBase)) + def test_fileio_warnings(self): + with test_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(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, |