[Python-checkins] r83030 - python/branches/py3k/Lib/test/test_array.py

antoine.pitrou python-checkins at python.org
Wed Jul 21 18:41:31 CEST 2010


Author: antoine.pitrou
Date: Wed Jul 21 18:41:31 2010
New Revision: 83030

Log:
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)



Modified:
   python/branches/py3k/Lib/test/test_array.py

Modified: python/branches/py3k/Lib/test/test_array.py
==============================================================================
--- python/branches/py3k/Lib/test/test_array.py	(original)
+++ python/branches/py3k/Lib/test/test_array.py	Wed Jul 21 18:41:31 2010
@@ -326,6 +326,17 @@
                 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')


More information about the Python-checkins mailing list