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

Method test_encoding

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

Source from the content-addressed store, hash-verified

1179 self.open, self.filename, "rb", newline="\n")
1180
1181 def test_encoding(self):
1182 # Test non-default encoding.
1183 text = self.TEXT.decode("ascii")
1184 text_native_eol = text.replace("\n", os.linesep)
1185 with self.open(self.filename, "wt", encoding="utf-16-le") as f:
1186 f.write(text)
1187 with open(self.filename, "rb") as f:
1188 file_data = ext_decompress(f.read()).decode("utf-16-le")
1189 self.assertEqual(file_data, text_native_eol)
1190 with self.open(self.filename, "rt", encoding="utf-16-le") as f:
1191 self.assertEqual(f.read(), text)
1192
1193 def test_encoding_error_handler(self):
1194 # 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