File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,28 @@ def test_forward(self):
5252 self .history .forward ()
5353 self .assertEqual (self .history .forward (), '#999' )
5454
55+ def test_MatchesIterator (self ):
56+ matches = ['bobby' , 'bobbies' , 'bobberina' ]
5557
58+ matches_iterator = repl .MatchesIterator (
59+ current_word = 'bob' ,
60+ matches = matches )
5661
62+ # should be falsey before we enter (i.e. 'not active')
63+ self .assertEqual (bool (matches_iterator ), False )
64+
65+ matched = []
66+ for i , x in enumerate (matches_iterator ):
67+ matched .append (x )
68+ if i == 8 :
69+ break
70+
71+ self .assertEqual (matched , matches * 3 )
72+
73+ # should be truthy once we have an active match
74+ self .assertEqual (bool (matches_iterator ), True )
75+
76+ self .assertEqual (matches_iterator .current (), (matches * 3 )[- 1 ])
5777
5878if __name__ == '__main__' :
5979 unittest .main ()
You can’t perform that action at this time.
0 commit comments