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_bz2.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_bz2.py')
-rw-r--r-- | Lib/test/test_bz2.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py index 0f8d149..cc416ed 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: |