Commit 709d5a81 authored by Georg Brandl's avatar Georg Brandl

Add an additional test: BZ2File write methods should raise IOError

when file is read-only.
parent aa72b8db
......@@ -172,6 +172,15 @@ class BZ2FileTest(BaseTest):
self.assertEqual(self.decompress(f.read()), self.TEXT)
f.close()
def testWriteMethodsOnReadOnlyFile(self):
bz2f = BZ2File(self.filename, "w")
bz2f.write("abc")
bz2f.close()
bz2f = BZ2File(self.filename, "r")
self.assertRaises(IOError, bz2f.write, "a")
self.assertRaises(IOError, bz2f.writelines, ["a"])
def testSeekForward(self):
# "Test BZ2File.seek(150, 0)"
self.createTempFile()
......
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