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

Method test_file_dict

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

Source from the content-addressed store, hash-verified

2326 self.assertRaises(ValueError, f.tell)
2327
2328 def test_file_dict(self):
2329 # default
2330 bi = io.BytesIO()
2331 with ZstdFile(bi, 'w', zstd_dict=TRAINED_DICT) as f:
2332 f.write(SAMPLES[0])
2333 bi.seek(0)
2334 with ZstdFile(bi, zstd_dict=TRAINED_DICT) as f:
2335 dat = f.read()
2336 self.assertEqual(dat, SAMPLES[0])
2337
2338 # .as_(un)digested_dict
2339 bi = io.BytesIO()
2340 with ZstdFile(bi, 'w', zstd_dict=TRAINED_DICT.as_digested_dict) as f:
2341 f.write(SAMPLES[0])
2342 bi.seek(0)
2343 with ZstdFile(bi, zstd_dict=TRAINED_DICT.as_undigested_dict) as f:
2344 dat = f.read()
2345 self.assertEqual(dat, SAMPLES[0])
2346
2347 def test_file_prefix(self):
2348 bi = io.BytesIO()

Callers

nothing calls this directly

Calls 5

seekMethod · 0.95
ZstdFileClass · 0.90
writeMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected