@@ -62,7 +62,7 @@ def test_run_line(self):
6262 orig_stdout = sys .stdout
6363 sys .stdout = self .repl .stdout
6464 [self .repl .add_normal_character (c ) for c in '1 + 1' ]
65- self .repl .on_enter ()
65+ self .repl .on_enter (insert_into_history = False )
6666 screen = fsarray ([u'>>> 1 + 1' , '2' , 'Welcome to' ])
6767 self .assert_paint_ignoring_formatting (screen , (1 , 1 ))
6868 finally :
@@ -105,7 +105,8 @@ def enter(self, line=None):
105105 if line is not None :
106106 self .repl .current_line = line
107107 with output_to_repl (self .repl ):
108- self .repl .on_enter ()
108+ self .repl .on_enter (insert_into_history = False )
109+ self .assertEqual (self .repl .rl_history .entries , ['' ])
109110 self .send_refreshes ()
110111
111112 def undo (self ):
@@ -432,7 +433,7 @@ def test_cursor_stays_at_bottom_of_screen(self):
432433 self .repl .width = 50
433434 self .repl .current_line = "__import__('random').__name__"
434435 with output_to_repl (self .repl ):
435- self .repl .on_enter ()
436+ self .repl .on_enter (insert_into_history = False )
436437 screen = [u">>> __import__('random').__name__" ,
437438 u"'random'" ]
438439 self .assert_paint_ignoring_formatting (screen )
@@ -451,15 +452,28 @@ def test_cursor_stays_at_bottom_of_screen(self):
451452 u">>> " ]
452453 self .assert_paint_ignoring_formatting (screen , (2 , 4 ))
453454
454- def test_unhighlight_paren_bug (self ):
455- """infobox showing up during intermediate render was causing this to fail, #371"""
455+ def test_unhighlight_paren_bugs (self ):
456+ """two previous bugs, paren did't highlight until next render
457+ and paren didn't unhighlight until enter"""
458+ self .assertEqual (self .repl .rl_history .entries , ['' ])
456459 self .enter ('(' )
460+ self .assertEqual (self .repl .rl_history .entries , ['' ])
457461 screen = [u">>> (" ,
458462 u"... " ]
463+ self .assertEqual (self .repl .rl_history .entries , ['' ])
459464 self .assert_paint_ignoring_formatting (screen )
465+ self .assertEqual (self .repl .rl_history .entries , ['' ])
460466
461467 with output_to_repl (self .repl ):
468+ self .assertEqual (self .repl .rl_history .entries , ['' ])
462469 self .repl .process_event (')' )
470+ self .assertEqual (self .repl .rl_history .entries , ['' ])
471+ screen = fsarray ([cyan (u">>> " )+ on_magenta (bold (red ('(' ))),
472+ green (u"... " )+ on_magenta (bold (red (')' )))])
473+ self .assert_paint (screen , (1 , 5 ))
474+
475+ with output_to_repl (self .repl ):
476+ self .repl .process_event (' ' )
463477 screen = fsarray ([cyan (u">>> " )+ yellow ('(' ),
464- green (u"... " )+ yellow (')' )])
465- self .assert_paint (screen , (1 , 3 ))
478+ green (u"... " )+ yellow (')' )+ bold ( cyan ( " " )) ])
479+ self .assert_paint (screen , (1 , 6 ))
0 commit comments