def testTokenListIterability( self ): """TokenList should be iterable""" tokens = TokenList() the_tokens = [ Token( 'IDENTIFIER', 'first'), Token( 'IDENTIFIER', 'second' ) ] tokens.append( the_tokens ) for token in tokens: self.assertEqual( token, tokens.next() )
def testTokenListAppendTuple( self ): """TokenList.append should append a tuple correctly""" tokens = TokenList() the_tokens = ( Token( 'IDENTIFIER', 'first'), Token( 'IDENTIFIER', 'second' ) ) tokens.append( the_tokens ) self.assertEqual( the_tokens[0], tokens.next() ) self.assertEqual( the_tokens[1], tokens.next() )
def testTokenListAppendSingle( self ): """TokenList.append should append a single Token correctly""" tokens = TokenList() the_token = Token( 'IDENTIFIER', 'x') tokens.append( the_token ) self.assertEqual( the_token, tokens.next() )