summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-07-21 16:47:28 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-07-21 16:47:28 (GMT)
commit7a7013e8304a5e54782330fe91e96e510d63e72e (patch)
tree96455204410767ee2046b65699f9738afaa0bcbe /Lib/test/test_array.py
parent2f3379f978516aaa3719d56e0ea9d91aca3c6fcc (diff)
downloadcpython-7a7013e8304a5e54782330fe91e96e510d63e72e.zip
cpython-7a7013e8304a5e54782330fe91e96e510d63e72e.tar.gz
cpython-7a7013e8304a5e54782330fe91e96e510d63e72e.tar.bz2
Merged revisions 83030 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83030 | antoine.pitrou | 2010-07-21 18:41:31 +0200 (mer., 21 juil. 2010) | 5 lines 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-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 6a573e1..a4aeccf 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')