Kaydet (Commit) f205c13f authored tarafından Skip Montanaro's avatar Skip Montanaro

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.
üst 5423abd1
...@@ -120,6 +120,8 @@ class AutoFileTests(unittest.TestCase): ...@@ -120,6 +120,8 @@ class AutoFileTests(unittest.TestCase):
except: except:
self.assertEquals(self.f.__exit__(*sys.exc_info()), None) self.assertEquals(self.f.__exit__(*sys.exc_info()), None)
def testReadWhenWriting(self):
self.assertRaises(IOError, self.f.read)
class OtherFileTests(unittest.TestCase): class OtherFileTests(unittest.TestCase):
......
...@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1 ...@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins 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 - Issue #2467: gc.DEBUG_STATS reported invalid elapsed times. Also, always
print elapsed times, not only when some objects are uncollectable / print elapsed times, not only when some objects are uncollectable /
unreachable. Original patch by Neil Schemenauer. unreachable. Original patch by Neil Schemenauer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment