summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_lzma.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-02-11 23:51:38 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-02-11 23:51:38 (GMT)
commitae557d767fa0862188a17914eb07b74088ed4d29 (patch)
treeacd9d5cb6fd49f4cb40399eec3b866d10e8f855a /Lib/test/test_lzma.py
parentd7e5c6ed7f8402a3ce2e6acb0cc6253456878773 (diff)
downloadcpython-ae557d767fa0862188a17914eb07b74088ed4d29.zip
cpython-ae557d767fa0862188a17914eb07b74088ed4d29.tar.gz
cpython-ae557d767fa0862188a17914eb07b74088ed4d29.tar.bz2
Fix seekable() in BZ2File and LZMAFile to check whether the underlying file supports seek().
Diffstat (limited to 'Lib/test/test_lzma.py')
-rw-r--r--Lib/test/test_lzma.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py
index 8d3df92..ffde557 100644
--- a/Lib/test/test_lzma.py
+++ b/Lib/test/test_lzma.py
@@ -525,6 +525,15 @@ class FileTestCase(unittest.TestCase):
f.close()
self.assertRaises(ValueError, f.seekable)
+ src = BytesIO(COMPRESSED_XZ)
+ src.seekable = lambda: False
+ f = LZMAFile(fileobj=src)
+ try:
+ self.assertFalse(f.seekable())
+ finally:
+ f.close()
+ self.assertRaises(ValueError, f.seekable)
+
def test_readable(self):
f = LZMAFile(fileobj=BytesIO(COMPRESSED_XZ))
try: