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

Method test_encoding

Lib/test/test_bz2.py:1172–1182  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1170 self.open, self.filename, "rb", newline="\n")
1171
1172 def test_encoding(self):
1173 # Test non-default encoding.
1174 text = self.TEXT.decode("ascii")
1175 text_native_eol = text.replace("\n", os.linesep)
1176 with self.open(self.filename, "wt", encoding="utf-16-le") as f:
1177 f.write(text)
1178 with open(self.filename, "rb") as f:
1179 file_data = ext_decompress(f.read()).decode("utf-16-le")
1180 self.assertEqual(file_data, text_native_eol)
1181 with self.open(self.filename, "rt", encoding="utf-16-le") as f:
1182 self.assertEqual(f.read(), text)
1183
1184 def test_encoding_error_handler(self):
1185 # Test with non-default encoding error handler.

Callers

nothing calls this directly

Calls 8

openMethod · 0.95
ext_decompressFunction · 0.85
openFunction · 0.50
decodeMethod · 0.45
replaceMethod · 0.45
writeMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected