示例#1
0
 def testBadSemeantic(self):
     program = 'if 1<2:\n    pass\nelse:\n   pass\nelif 1<2:\n   pass\n'
     tokens = lex(program)
     iS = IfStatement.parse(tokens)
     sIS = iS.semantic(Scope(None))
     self.assertRaises(Exception, iS.semantic(Scope(None)))
示例#2
0
 def ifParse():
     IfStatement.parse(tokens)
示例#3
0
 def testSemantic(self):
     program = 'if 1<2:\n    pass\nelif 1<2:\n   pass\nelse:\n   pass\n'
     tokens = lex(program)
     iS = IfStatement.parse(tokens)
     sIS = iS.semantic(Scope(None))
     self.failUnless(isinstance(sIS,IfStatement), tokens)
示例#4
0
 def testParse(self):
     program = 'if 1<2:\n    pass\nelse:\n   pass\n'
     tokens = lex(program)
     i = IfStatement.parse(tokens)
     self.failUnless(isinstance(i, IfStatement))