summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2006-12-23 16:40:13 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2006-12-23 16:40:13 (GMT)
commit6baa5027699c6238d545a9b18c70567882517eae (patch)
tree5c7a0ab8c2f987b214a6a2e37329ba57e428daee /Lib/test/test_tarfile.py
parent55c54a2fa13b0238e7de5f94ea697eab38a40069 (diff)
downloadcpython-6baa5027699c6238d545a9b18c70567882517eae.zip
cpython-6baa5027699c6238d545a9b18c70567882517eae.tar.gz
cpython-6baa5027699c6238d545a9b18c70567882517eae.tar.bz2
Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()
work correctly together with readline(). Will backport to 2.5.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 56cc919..867eca4 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -110,7 +110,7 @@ class ReadTest(BaseTest):
"""Test seek() method of _FileObject, incl. random reading.
"""
if self.sep != "|":
- filename = "0-REGTYPE"
+ filename = "0-REGTYPE-TEXT"
self.tar.extract(filename, dirname())
f = open(os.path.join(dirname(), filename), "rb")
data = f.read()
@@ -149,6 +149,16 @@ class ReadTest(BaseTest):
s2 = fobj.readlines()
self.assert_(s1 == s2,
"readlines() after seek failed")
+ fobj.seek(0)
+ self.assert_(len(fobj.readline()) == fobj.tell(),
+ "tell() after readline() failed")
+ fobj.seek(512)
+ self.assert_(len(fobj.readline()) + 512 == fobj.tell(),
+ "tell() after seek() and readline() failed")
+ fobj.seek(0)
+ line = fobj.readline()
+ self.assert_(fobj.read() == data[len(line):],
+ "read() after readline() failed")
fobj.close()
def test_old_dirtype(self):