コード例 #1
0
class TestCSTFunctionPython(unittest.TestCase):
    def setUp(self):
        import langscape
        from langscape.langlets.python.cstfunction import LangletCSTFunction
        self.langlet = langscape.load_langlet("python")
        self.fn = LangletCSTFunction(self.langlet)

    def test_is_atomic(self):
        cst = self.langlet.parse("1+2\n")
        self.assertFalse(self.fn.is_atomic(cst))
        self.assertTrue(find_node(cst, self.langlet.parse_symbol.atom))
        self.assertTrue(self.fn.is_atomic(self.langlet.fn.Number("4")))

    def test_pprint_simple2(self):
        cst = self.langlet.parse("1+3\n")
コード例 #2
0
 def setUp(self):
     import langscape
     from langscape.langlets.python.cstfunction import LangletCSTFunction
     self.langlet = langscape.load_langlet("coverage")
     self.fn = LangletCSTFunction(self.langlet)