Fix seekable() in BZ2File and LZMAFile to check whether the underlying file supports seek().

This commit is contained in:
Nadeem Vawda 2012-02-12 01:51:38 +02:00
parent d7e5c6ed7f
commit ae557d767f
4 changed files with 28 additions and 4 deletions

View file

@ -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: