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

Commit 9e2170c

Browse filesBrowse files
committed
WIP: Add test
This test does not work yet :-(
1 parent eae92aa commit 9e2170c
Copy full SHA for 9e2170c

File tree

1 file changed

+24
-1
lines changed
Filter options

1 file changed

+24
-1
lines changed

‎Lib/test/test_pyrepl.py

Copy file name to clipboardExpand all lines: Lib/test/test_pyrepl.py
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def test_global_namespace_completion(self):
607607
output = multiline_input(reader, namespace)
608608
self.assertEqual(output, "python")
609609

610-
def test_updown_arrow_with_completion_menu(self):
610+
def test_up_down_arrows_with_completion_menu(self):
611611
"""Up arrow in the middle of unfinished tab completion when the menu is displayed
612612
should work and trigger going back in history. Down arrow should subsequently
613613
get us back to the incomplete command."""
@@ -633,6 +633,29 @@ def test_updown_arrow_with_completion_menu(self):
633633
self.assertEqual(output, "os.")
634634

635635

636+
def test_right_down_arrows_with_completion_menu(self):
637+
"""Right / Down arrows while the tab completion menu is displayed
638+
should do nothing"""
639+
code = "os.\t\t"
640+
namespace = {"os": os}
641+
642+
events = itertools.chain(
643+
code_to_events(code),
644+
[
645+
Event(evt="key", data="down", raw=bytearray(b"\x1bOB")),
646+
Event(evt="key", data="right", raw=bytearray(b"\x1bOC")),
647+
],
648+
code_to_events("\n")
649+
)
650+
reader = self.prepare_reader(events, namespace=namespace)
651+
output = multiline_input(reader, namespace)
652+
self.assertEqual(output, "os.")
653+
# When we press right and/or down arrow while
654+
# the completions menu is displayed,
655+
# the cursor should stay where it was on the line.
656+
self.assertEqual(reader.cmpltn_menu_vis, 1)
657+
self.assertEqual(reader.cxy, (6, 0))
658+
636659
@patch("_pyrepl.curses.tigetstr", lambda x: b"")
637660
class TestUnivEventQueue(TestCase):
638661
def setUp(self):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.