[Python-checkins] CVS: python/dist/src/Lib/test test_gzip.py,1.6,1.7
Martin v. L?wis
loewis@users.sourceforge.net
Thu, 09 Aug 2001 00:21:58 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv912/Lib/test
Modified Files:
test_gzip.py
Log Message:
Patch #448474: Add support for tell() and seek() to gzip.GzipFile.
Index: test_gzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_gzip.py 2001/01/17 21:43:06 1.6
--- test_gzip.py 2001/08/09 07:21:56 1.7
***************
*** 51,54 ****
--- 51,78 ----
f.close()
+ # Try seek, read test
+
+ f = gzip.GzipFile(filename)
+ while 1:
+ oldpos = f.tell()
+ line1 = f.readline()
+ if not line1: break
+ newpos = f.tell()
+ f.seek(oldpos) # negative seek
+ if len(line1)>10:
+ amount = 10
+ else:
+ amount = len(line1)
+ line2 = f.read(amount)
+ verify(line1[:amount] == line2)
+ f.seek(newpos) # positive seek
+ f.close()
+
+ # Try seek, write test
+ f = gzip.GzipFile(filename, 'w')
+ for pos in range(0, 256, 16):
+ f.seek(pos)
+ f.write('GZ\n')
+ f.close()
os.unlink(filename)