summaryrefslogtreecommitdiff
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-02-12 01:51:38 +0200
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-02-12 01:51:38 +0200
commitae557d767fa0862188a17914eb07b74088ed4d29 (patch)
treeacd9d5cb6fd49f4cb40399eec3b866d10e8f855a /Lib/test/test_bz2.py
parentd7e5c6ed7f8402a3ce2e6acb0cc6253456878773 (diff)
downloadcpython-git-ae557d767fa0862188a17914eb07b74088ed4d29.tar.gz
Fix seekable() in BZ2File and LZMAFile to check whether the underlying file supports seek().
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r--Lib/test/test_bz2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 0f8d14910f..cc416ed301 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -372,6 +372,15 @@ class BZ2FileTest(BaseTest):
bz2f.close()
self.assertRaises(ValueError, bz2f.seekable)
+ src = BytesIO(self.DATA)
+ src.seekable = lambda: False
+ bz2f = BZ2File(fileobj=src)
+ try:
+ self.assertFalse(bz2f.seekable())
+ finally:
+ bz2f.close()
+ self.assertRaises(ValueError, bz2f.seekable)
+
def testReadable(self):
bz2f = BZ2File(fileobj=BytesIO(self.DATA))
try: