mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Fix seekable() in BZ2File and LZMAFile to check whether the underlying file supports seek().
This commit is contained in:
parent
d7e5c6ed7f
commit
ae557d767f
4 changed files with 28 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue