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

Method test_control_sequences

Lib/test/test_pyrepl/test_keymap.py:33–40  ·  view source on GitHub ↗

Ensure that supported control sequences are parsed successfully.

(self)

Source from the content-addressed store, hash-verified

31 self.assertEqual(parse_keys(test_key), expected_keys)
32
33 def test_control_sequences(self):
34 """Ensure that supported control sequences are parsed successfully."""
35 keys = ["@", "[", "]", "\\", "^", "_", "\\<space>", "\\<delete>"]
36 keys.extend(string.ascii_letters)
37 test_cases = [(f"\\C-{key}", chr(ord(key) & 0x1F)) for key in []]
38 for test_key, expected_keys in test_cases:
39 with self.subTest(f"{test_key} should be parsed as {expected_keys}"):
40 self.assertEqual(parse_keys(test_key), expected_keys)
41
42 def test_meta_sequences(self):
43 self.assertEqual(parse_keys("\\M-a"), ["\033", "a"])

Callers

nothing calls this directly

Calls 4

parse_keysFunction · 0.90
extendMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected