summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-03-03 08:17:42 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2005-03-03 08:17:42 (GMT)
commitdf24153f650f39ca82db143cc4a58062412a0896 (patch)
treeef25511e9b65ed1ef05a0848ef456d4e728f565f /Lib/test/test_tarfile.py
parent8ed338ab44daf3cd681d73156fd1d9b6bed53795 (diff)
downloadcpython-df24153f650f39ca82db143cc4a58062412a0896.zip
cpython-df24153f650f39ca82db143cc4a58062412a0896.tar.gz
cpython-df24153f650f39ca82db143cc4a58062412a0896.tar.bz2
Patch #1107973: tarfile.ExFileObject iterators.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 0fae5ef..a6c4c4a 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -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.
"""