[Python-checkins] r51287 - python/trunk/Lib/test/test_bz2.py
georg.brandl
python-checkins at python.org
Mon Aug 14 23:45:33 CEST 2006
Author: georg.brandl
Date: Mon Aug 14 23:45:32 2006
New Revision: 51287
Modified:
python/trunk/Lib/test/test_bz2.py
Log:
Add an additional test: BZ2File write methods should raise IOError
when file is read-only.
Modified: python/trunk/Lib/test/test_bz2.py
==============================================================================
--- python/trunk/Lib/test/test_bz2.py (original)
+++ python/trunk/Lib/test/test_bz2.py Mon Aug 14 23:45:32 2006
@@ -172,6 +172,15 @@
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()
More information about the Python-checkins
mailing list