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

Method test_escape_encode

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

Source from the content-addressed store, hash-verified

2642 self.assertEqual(decode(bytes([b]) + b'0'), (chr(b) + '0', 2))
2643
2644 def test_escape_encode(self):
2645 encode = codecs.unicode_escape_encode
2646 check = coding_checker(self, encode)
2647 check('\t', br'\t')
2648 check('\n', br'\n')
2649 check('\r', br'\r')
2650 check('\\', br'\\')
2651 for b in range(32):
2652 if chr(b) not in '\t\n\r':
2653 check(chr(b), ('\\x%02x' % b).encode())
2654 for b in range(127, 256):
2655 check(chr(b), ('\\x%02x' % b).encode())
2656 check('\u20ac', br'\u20ac')
2657 check('\U0001d120', br'\U0001d120')
2658
2659 def test_escape_decode(self):
2660 decode = codecs.unicode_escape_decode

Callers

nothing calls this directly

Calls 3

coding_checkerFunction · 0.85
checkFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected