diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-21 16:41:31 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-21 16:41:31 (GMT) |
commit | 8cb6dbf1b9d606de4ef1b3c4141ae186d32492db (patch) | |
tree | 7f81f13da0c81134d984f0422c7129c7d37485f8 /Lib/test/test_array.py | |
parent | de5b02430b7b7fb8ec417bd05d9f7c4980587802 (diff) | |
download | cpython-8cb6dbf1b9d606de4ef1b3c4141ae186d32492db.zip cpython-8cb6dbf1b9d606de4ef1b3c4141ae186d32492db.tar.gz cpython-8cb6dbf1b9d606de4ef1b3c4141ae186d32492db.tar.bz2 |
Issue #5395: check that array.fromfile() re-raises an IOError instead of replacing it
with EOFError.
(this is only an added test, but 2.x will get a fix too)
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-x | Lib/test/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 5de562f..d8d4ea7 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -326,6 +326,17 @@ class BaseTest(unittest.TestCase): f.close() support.unlink(support.TESTFN) + def test_fromfile_ioerror(self): + # Issue #5395: Check if fromfile raises a proper IOError + # instead of EOFError. + a = array.array(self.typecode) + f = open(support.TESTFN, 'wb') + try: + self.assertRaises(IOError, a.fromfile, f, len(self.example)) + finally: + f.close() + support.unlink(support.TESTFN) + def test_filewrite(self): a = array.array(self.typecode, 2*self.example) f = open(support.TESTFN, 'wb') |