@@ -54,7 +54,29 @@ def test_forward(self):
5454 self .history .forward ()
5555 self .assertEqual (self .history .forward (), '#999' )
5656
57- def test_MatchesIterator (self ):
57+ def test_append (self ):
58+ self .history .append ('print "foo\n "\n ' )
59+ self .history .append ('\n ' )
60+
61+ self .assertEqual (self .history .back (), 'print "foo\n "' )
62+
63+ def test_enter (self ):
64+ self .history .enter ('#lastnumber!' )
65+
66+ self .assertEqual (self .history .back (), '#999' )
67+ self .assertEqual (self .history .forward (), '#lastnumber!' )
68+
69+ def test_reset (self ):
70+ self .history .enter ('#lastnumber!' )
71+ self .history .reset ()
72+
73+ self .assertEqual (self .history .back (), '#999' )
74+ self .assertEqual (self .history .forward (), '' )
75+
76+
77+ class TestMatchesIterator (unittest .TestCase ):
78+
79+ def test_all (self ):
5880 matches = ['bobby' , 'bobbies' , 'bobberina' ]
5981
6082 matches_iterator = repl .MatchesIterator (
@@ -65,12 +87,13 @@ def test_MatchesIterator(self):
6587 self .assertFalse (matches_iterator )
6688
6789 slice = itertools .islice (matches_iterator , 0 , 9 )
68- self .assertEqual (list (slice ),matches * 3 )
90+ self .assertEqual (list (slice ), matches * 3 )
6991
7092 # should be truthy once we have an active match
7193 self .assertTrue (matches_iterator )
7294
7395 self .assertEqual (matches_iterator .current (), (matches * 3 )[- 1 ])
7496
97+
7598if __name__ == '__main__' :
7699 unittest .main ()
0 commit comments