Esempio n. 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)))
Esempio n. 2
0
 def ifParse():
     IfStatement.parse(tokens)
Esempio n. 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)
Esempio n. 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))