summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2006-12-23 16:51:47 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2006-12-23 16:51:47 (GMT)
commitaedb92e59c2f4c3c33fbb33d5dc4afefe344620c (patch)
treeeb17ea20b2ac6b85bfb819630ce1d70e5cfa3fa3 /Lib/test/test_tarfile.py
parent60775f29de0e6107a46f668144cb1c133d6e5147 (diff)
downloadcpython-aedb92e59c2f4c3c33fbb33d5dc4afefe344620c.zip
cpython-aedb92e59c2f4c3c33fbb33d5dc4afefe344620c.tar.gz
cpython-aedb92e59c2f4c3c33fbb33d5dc4afefe344620c.tar.bz2
Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()
work correctly together with readline(). (backport from rev. 53153)
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 2685d67..f229fa5 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):