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

Method test_iterator

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected