Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-111201: Add more tests to test_pyrepl to cover key translation #118705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
blacklit paradise
  • Loading branch information
ambv committed May 20, 2024
commit 9f9bc819d0af861a54abc2d886adb1b8f04a1a9f
17 changes: 10 additions & 7 deletions 17 Lib/test/test_pyrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,10 @@ def test_updown_arrow_with_completion_menu(self):
events = itertools.chain(
code_to_events(code),
[
Event(evt='key', data='up', raw=bytearray(b'\x1bOA')),
Event(evt="key", data="up", raw=bytearray(b"\x1bOA")),
Event(evt="key", data="down", raw=bytearray(b"\x1bOB")),
],
code_to_events("\n")
code_to_events("\n"),
)
reader = self.prepare_reader(events, namespace=namespace)
output = multiline_input(reader, namespace)
Expand Down Expand Up @@ -1018,10 +1018,12 @@ def test_setpos_fromxy_in_wrapped_line(self):
self.assertEqual(reader.pos, 9)

def test_up_arrow_after_ctrl_r(self):
events = iter([
Event(evt='key', data='\x12', raw=bytearray(b'\x12')),
Event(evt='key', data='up', raw=bytearray(b'\x1bOA')),
])
events = iter(
[
Event(evt="key", data="\x12", raw=bytearray(b"\x12")),
Event(evt="key", data="up", raw=bytearray(b"\x1bOA")),
]
)

reader, _ = handle_all_events(events)
self.assert_screen_equals(reader, "")
Expand Down Expand Up @@ -1124,6 +1126,7 @@ def test_empty(self):
translator.get()
self.assertTrue(translator.empty())


class TestParseKeys(unittest.TestCase):
def test_single_character(self):
self.assertEqual(parse_keys("a"), ["a"])
Expand Down Expand Up @@ -1195,5 +1198,5 @@ def test_nested_multiple_keymaps(self):
self.assertEqual(result, {b"a": {b"b": {b"c": "action"}}})


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.