MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_seek_read

Method test_seek_read

Lib/test/test_gzip.py:287–304  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

285 if L == []: break
286
287 def test_seek_read(self):
288 self.test_write()
289 # Try seek, read test
290
291 with gzip.GzipFile(self.filename) as f:
292 while 1:
293 oldpos = f.tell()
294 line1 = f.readline()
295 if not line1: break
296 newpos = f.tell()
297 f.seek(oldpos) # negative seek
298 if len(line1)>10:
299 amount = 10
300 else:
301 amount = len(line1)
302 line2 = f.read(amount)
303 self.assertEqual(line1[:amount], line2)
304 f.seek(newpos) # positive seek
305
306 def test_seek_whence(self):
307 self.test_write()

Callers

nothing calls this directly

Calls 7

test_writeMethod · 0.95
lenFunction · 0.85
tellMethod · 0.45
readlineMethod · 0.45
seekMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected