#NEWLINE# def test_and( ) : #NEWLINE# #INDENT# def grammar( ) : #NEWLINE# #INDENT# return ( 'a' , And ( 'b' ) , [ 'c' , 'b' ] , EOF ) #NEWLINE# #UNINDENT# parser = ParserPython ( grammar ) #NEWLINE# parsed = parser . parse ( 'ab' ) #NEWLINE# assert ( str ( parsed ) == 'a | b | ' ) #NEWLINE# assert ( repr ( parsed ) == "[  'a' [0],  'b' [1], EOF [2] ]" ) #NEWLINE# with pytest . raises ( NoMatch ) : #NEWLINE# #INDENT# parser . parse ( 'ac' ) #NEWLINE# #UNINDENT# with pytest . raises ( NoMatch ) : #NEWLINE# #INDENT# parser . parse ( 'abb' )