mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Patch #1107973: tarfile.ExFileObject iterators.
This commit is contained in:
parent
8ed338ab44
commit
df24153f65
3 changed files with 28 additions and 0 deletions
|
@ -91,6 +91,16 @@ class ReadTest(BaseTest):
|
|||
self.assert_(lines1 == lines2,
|
||||
"_FileObject.readline() does not work correctly")
|
||||
|
||||
def test_iter(self):
|
||||
# Test iteration over ExFileObject.
|
||||
if self.sep != "|":
|
||||
filename = "0-REGTYPE-TEXT"
|
||||
self.tar.extract(filename, dirname())
|
||||
lines1 = file(os.path.join(dirname(), filename), "rU").readlines()
|
||||
lines2 = [line for line in self.tar.extractfile(filename)]
|
||||
self.assert_(lines1 == lines2,
|
||||
"ExFileObject iteration does not work correctly")
|
||||
|
||||
def test_seek(self):
|
||||
"""Test seek() method of _FileObject, incl. random reading.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue