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

Method test_basic

Lib/test/test_codecs.py:2028–2036  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2026class EncodedFileTest(unittest.TestCase):
2027
2028 def test_basic(self):
2029 f = io.BytesIO(b'\xed\x95\x9c\n\xea\xb8\x80')
2030 ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8')
2031 self.assertEqual(ef.read(), b'\\\xd5\n\x00\x00\xae')
2032
2033 f = io.BytesIO()
2034 ef = codecs.EncodedFile(f, 'utf-8', 'latin-1')
2035 ef.write(b'\xc3\xbc')
2036 self.assertEqual(f.getvalue(), b'\xfc')
2037
2038all_unicode_encodings = [
2039 "ascii",

Callers

nothing calls this directly

Calls 4

getvalueMethod · 0.95
assertEqualMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected