mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members.
This commit is contained in:
parent
fec925b315
commit
df32b3967c
2 changed files with 11 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue