Exemplo n.º 1
0
 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() )
Exemplo n.º 2
0
 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() )
Exemplo n.º 3
0
 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() )