1 import antlr3 2 import testbase 3 import unittest 4 5 class t013parser(testbase.ANTLRTest): 6 def setUp(self): 7 self.compileGrammar() 8 9 10 def testValid(self): 11 cStream = antlr3.StringStream('foobar') 12 lexer = self.getLexer(cStream) 13 tStream = antlr3.CommonTokenStream(lexer) 14 parser = self.getParser(tStream) 15 parser.document() 16 17 self.assertEqual(parser.events, ['before', 'after']) 18 19 20 if __name__ == '__main__': 21 unittest.main() 22