summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-12-23 13:07:51 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-12-23 13:07:51 (GMT)
commitedf14317e32ae945d9b1fe554a7be6ed3dde2834 (patch)
tree3e2f6a4f2c02f1bbd3d153bd50d930ea04654c35
parentb90b144c470b203899442b3a9d637c023a778bd9 (diff)
downloadcpython-edf14317e32ae945d9b1fe554a7be6ed3dde2834.zip
cpython-edf14317e32ae945d9b1fe554a7be6ed3dde2834.tar.gz
cpython-edf14317e32ae945d9b1fe554a7be6ed3dde2834.tar.bz2
Backport of r67908:
Added test case to ensure attempts to read from a file opened for writing fail.
-rw-r--r--Lib/test/test_file.py2
-rw-r--r--Misc/NEWS6
2 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 8308710..f678df6 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 f7ff496..b581a78 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?
===========================