summaryrefslogtreecommitdiff
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-xLib/test/test_array.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 6a573e1000..a4aeccf695 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -188,6 +188,17 @@ class BaseTest(unittest.TestCase):
f.close()
test_support.unlink(test_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(test_support.TESTFN, 'wb')
+ try:
+ self.assertRaises(IOError, a.fromfile, f, len(self.example))
+ finally:
+ f.close()
+ test_support.unlink(test_support.TESTFN)
+
def test_filewrite(self):
a = array.array(self.typecode, 2*self.example)
f = open(test_support.TESTFN, 'wb')