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

Method test_encoding

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

Source from the content-addressed store, hash-verified

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