<s> import py <EOL> from pypy . rlib . parsing . parsing import PackratParser , Rule , Nonterminal <EOL> from pypy . rlib . parsing . parsing import Symbol , ParseError <EOL> from pypy . rlib . parsing . ebnfparse import parse_ebnf , make_parse_function <EOL> from pypy . rlib . parsing . deterministic import LexerError <EOL> from pypy . rlib . parsing . tree import RPythonVisitor <EOL> class TestDictError ( object ) : <EOL> dictebnf = """<STR_LIT>""" <EOL> def setup_class ( cls ) : <EOL> regexs , rules , ToAST = parse_ebnf ( cls . dictebnf ) <EOL> cls . ToAST = ToAST <EOL> parse = make_parse_function ( regexs , rules , eof = True ) <EOL> cls . parse = staticmethod ( parse ) <EOL> def test_lexererror ( self ) : <EOL> excinfo = py . test . raises ( LexerError , self . parse , """<STR_LIT>""" ) <EOL> msg = excinfo . value . nice_error_message ( "<STR_LIT>" ) <EOL> print msg <EOL> assert msg == """<STR_LIT>""" <EOL> def test_parseerror ( self ) : <EOL> source = """<STR_LIT>""" <EOL> excinfo = py . test . raises ( ParseError , self . parse , source ) <EOL> error = excinfo . value . errorinformation <EOL> source_pos = excinfo . value . source_pos <EOL> assert source_pos . lineno == <NUM_LIT:4> <EOL> assert source_pos . columnno == <NUM_LIT> <EOL> msg = excinfo . value . nice_error_message ( "<STR_LIT>" , source ) <EOL> print msg <EOL> assert msg == """<STR_LIT>""" </s>
