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.
This commit is contained in:
Skip Montanaro 2008-12-23 03:30:15 +00:00
parent 5423abd182
commit f205c13fac
2 changed files with 5 additions and 0 deletions

View File

@ -120,6 +120,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):

View File

@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
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
print elapsed times, not only when some objects are uncollectable /
unreachable. Original patch by Neil Schemenauer.