@@ -546,7 +546,7 @@ def test_global_namespace_completion(self):
546
546
output = multiline_input (reader , namespace )
547
547
self .assertEqual (output , "python" )
548
548
549
- def test_updown_arrow_with_completion_menu (self ):
549
+ def test_up_down_arrow_with_completion_menu (self ):
550
550
"""Up arrow in the middle of unfinished tab completion when the menu is displayed
551
551
should work and trigger going back in history. Down arrow should subsequently
552
552
get us back to the incomplete command."""
@@ -571,6 +571,30 @@ def test_updown_arrow_with_completion_menu(self):
571
571
output = multiline_input (reader , namespace )
572
572
self .assertEqual (output , "os." )
573
573
574
+ # TODO: This test doesn't seem to work as intended, it always succeeds
575
+ def test_right_down_arrows_with_completion_menu (self ):
576
+ """Right / Down arrows while the tab completion menu is displayed
577
+ should do nothing"""
578
+ code = "os.\t \t "
579
+ namespace = {"os" : os }
580
+
581
+ events = itertools .chain (
582
+ code_to_events (code ),
583
+ [
584
+ Event (evt = "key" , data = "down" , raw = bytearray (b"\x1b OB" )),
585
+ Event (evt = "key" , data = "right" , raw = bytearray (b"\x1b OC" )),
586
+ ],
587
+ code_to_events ("\n " )
588
+ )
589
+ reader = self .prepare_reader (events , namespace = namespace )
590
+ output = multiline_input (reader , namespace )
591
+ self .assertEqual (output , "os." )
592
+ # When we press right and/or down arrow while
593
+ # the completions menu is displayed,
594
+ # the cursor should stay where it was on the line.
595
+ self .assertEqual (reader .cmpltn_menu_vis , 1 )
596
+ self .assertEqual (reader .cxy , (6 , 0 ))
597
+
574
598
@patch ("_pyrepl.readline._ReadlineWrapper.get_reader" )
575
599
@patch ("sys.stderr" , new_callable = io .StringIO )
576
600
def test_completion_with_warnings (self , mock_stderr , mock_get_reader ):
0 commit comments