]> granicus.if.org Git - python/commitdiff
Backport of r67908:
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 23 Dec 2008 13:07:51 +0000 (13:07 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 23 Dec 2008 13:07:51 +0000 (13:07 +0000)
Added test case to ensure attempts to read from a file opened for writing
fail.

Lib/test/test_file.py
Misc/NEWS

index 830871098e1d12f718684ee44f9450f6f55babf5..f678df6f370d9069943f0d66efe808e5fdd09890 100644 (file)
@@ -116,6 +116,8 @@ class AutoFileTests(unittest.TestCase):
         except:
             self.assertEquals(self.f.__exit__(*sys.exc_info()), None)
 
+    def testReadWhenWriting(self):
+        self.assertRaises(IOError, self.f.read)
 
 class OtherFileTests(unittest.TestCase):
 
index f7ff496ca2f239e373269dcac35dbdfeb86ef149..b581a7888ecddec00740c86a80171a760ae2fd31 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,12 @@ What's New in Python 2.5.4?
 
 *Release date: XX-XXX-2009*
 
+Core and builtins
+-----------------
+
+- Added test case to ensure attempts to read from a file opened for writing
+  fail.
+
 
 What's New in Python 2.5.3?
 ===========================