From edf14317e32ae945d9b1fe554a7be6ed3dde2834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 23 Dec 2008 13:07:51 +0000 Subject: [PATCH] Backport of r67908: Added test case to ensure attempts to read from a file opened for writing fail. --- Lib/test/test_file.py | 2 ++ Misc/NEWS | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 830871098e1..f678df6f370 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -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): diff --git a/Misc/NEWS b/Misc/NEWS index f7ff496ca2f..b581a7888ec 100644 --- 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? ===========================