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

Method test_keynames

Lib/test/test_pyrepl/test_keymap.py:15–24  ·  view source on GitHub ↗

Ensure that keynames are parsed to their corresponding mapping. A keyname is expected to be of the following form: \\ such as \\ which would get parsed as "left".

(self)

Source from the content-addressed store, hash-verified

13 self.assertEqual(parse_keys(test_key), expected_keys)
14
15 def test_keynames(self):
16 """Ensure that keynames are parsed to their corresponding mapping.
17
18 A keyname is expected to be of the following form: \\<keyname> such as \\<left>
19 which would get parsed as "left".
20 """
21 test_cases = [(f"\\<{keyname}>", [parsed_keyname]) for keyname, parsed_keyname in _keynames.items()]
22 for test_key, expected_keys in test_cases:
23 with self.subTest(f"{test_key} should be parsed as {expected_keys}"):
24 self.assertEqual(parse_keys(test_key), expected_keys)
25
26 def test_escape_sequences(self):
27 """Ensure that escaping sequences are parsed to their corresponding mapping."""

Callers

nothing calls this directly

Calls 4

parse_keysFunction · 0.90
itemsMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected