From: Skip Montanaro Date: Tue, 23 Dec 2008 03:51:14 +0000 (+0000) Subject: Merged revisions 67908 via svnmerge from X-Git-Tag: v3.1a1~671 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80072cb7fa556f56ec3b3cea1ac00d0b0fa33419;p=python Merged revisions 67908 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r67908 | skip.montanaro | 2008-12-22 21:30:15 -0600 (Mon, 22 Dec 2008) | 4 lines As a result of a regression that snuck into 2.5.3 add a test case that ensures that when you try to read from a file opened for writing an IOError is raised. ........ --- diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index ff4996ae48..7a68b2f720 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -123,6 +123,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): diff --git a/Misc/NEWS b/Misc/NEWS index 98dae61c60..e247506af5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 3.1 alpha 0 Core and Builtins ----------------- +- Added test case to ensure attempts to read from a file opened for writing + fail. + - Issue #3106: Speedup some comparisons (str/str and int/int). - Issue #2183: Simplify and optimize bytecode for list, dict and set