]> granicus.if.org Git - python/commitdiff
As a result of a regression that snuck into 2.5.3 add a test case that
authorSkip Montanaro <skip@pobox.com>
Tue, 23 Dec 2008 03:30:15 +0000 (03:30 +0000)
committerSkip Montanaro <skip@pobox.com>
Tue, 23 Dec 2008 03:30:15 +0000 (03:30 +0000)
ensures that when you try to read from a file opened for writing an IOError
is raised.

Lib/test/test_file.py
Misc/NEWS

index 2d791a55c07f0df91f545cede9fff7c71440ca77..96f6da202355a0b6c4c20b47b2905ebd55d69a1f 100644 (file)
@@ -120,6 +120,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 ebe61057cef8efa2f2461155889aed8103c732b8..775392437c06ebb1522b7132650afcdfd9915e40 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
 Core and Builtins
 -----------------
 
+- Added test case to ensure attempts to read from a file opened for writing
+  fail.
+
 - Issue #2467: gc.DEBUG_STATS reported invalid elapsed times. Also, always
   print elapsed times, not only when some objects are uncollectable /
   unreachable. Original patch by Neil Schemenauer.