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

Method test_file_dict

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

Source from the content-addressed store, hash-verified

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