MCPcopy Index your code
hub / github.com/python/cpython / test_iterator

Method test_iterator

Lib/test/test_zstd.py:2046–2064  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2044 self.assertRaises(ValueError, f.peek)
2045
2046 def test_iterator(self):
2047 with io.BytesIO(THIS_FILE_BYTES) as f:
2048 lines = f.readlines()
2049 compressed = compress(THIS_FILE_BYTES)
2050
2051 # iter
2052 with ZstdFile(io.BytesIO(compressed)) as f:
2053 self.assertListEqual(list(iter(f)), lines)
2054
2055 # readline
2056 with ZstdFile(io.BytesIO(compressed)) as f:
2057 for line in lines:
2058 self.assertEqual(f.readline(), line)
2059 self.assertEqual(f.readline(), b'')
2060 self.assertEqual(f.readline(), b'')
2061
2062 # readlines
2063 with ZstdFile(io.BytesIO(compressed)) as f:
2064 self.assertListEqual(f.readlines(), lines)
2065
2066 def test_decompress_limited(self):
2067 _ZSTD_DStreamInSize = 128*_1K + 3

Callers

nothing calls this directly

Calls 7

compressFunction · 0.90
ZstdFileClass · 0.90
listClass · 0.85
assertListEqualMethod · 0.80
readlinesMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45

Tested by

no test coverage detected