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

Method test_encoding

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

Source from the content-addressed store, hash-verified

2575 self.assertEqual(file_data, DECOMPRESSED_100_PLUS_32KB)
2576
2577 def test_encoding(self):
2578 uncompressed = THIS_FILE_STR.replace(os.linesep, "\n")
2579
2580 with io.BytesIO() as bio:
2581 with open(bio, "wt", encoding="utf-16-le") as f:
2582 f.write(uncompressed)
2583 file_data = decompress(bio.getvalue()).decode("utf-16-le")
2584 self.assertEqual(file_data.replace(os.linesep, "\n"), uncompressed)
2585 bio.seek(0)
2586 with open(bio, "rt", encoding="utf-16-le") as f:
2587 self.assertEqual(f.read().replace(os.linesep, "\n"), uncompressed)
2588
2589 def test_encoding_error_handler(self):
2590 with io.BytesIO(compress(b"foo\xffbar")) as bio:

Callers

nothing calls this directly

Calls 9

openFunction · 0.90
decompressFunction · 0.90
replaceMethod · 0.45
writeMethod · 0.45
decodeMethod · 0.45
getvalueMethod · 0.45
assertEqualMethod · 0.45
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected