diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-02-11 23:51:38 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-02-11 23:51:38 (GMT) |
commit | ae557d767fa0862188a17914eb07b74088ed4d29 (patch) | |
tree | acd9d5cb6fd49f4cb40399eec3b866d10e8f855a /Lib/test/test_lzma.py | |
parent | d7e5c6ed7f8402a3ce2e6acb0cc6253456878773 (diff) | |
download | cpython-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.py | 9 |
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: |