diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index ff4996ae482..7a68b2f7203 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 98dae61c604..e247506af57 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