From: Antoine Pitrou Date: Wed, 21 Jul 2010 16:41:31 +0000 (+0000) Subject: Issue #5395: check that array.fromfile() re-raises an IOError instead of replacing it X-Git-Tag: v3.2a1~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cb6dbf1b9d606de4ef1b3c4141ae186d32492db;p=python 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) --- diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 5de562f19e..d8d4ea79c5 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')