Commit 3f9d9dfa authored by Antoine Pitrou's avatar Antoine Pitrou

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)
parent b3d89d20
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment