class TestCSTBuilderFileInput(unittest.TestCase): def setUp(self): import langscape self.python = langscape.load_langlet("python") self.cstbuilder = CSTBuilder(self.python) self.symbol = self.python.parse_symbol self.token = self.python.parse_token def test_testlist(self): stmt = find_node(self.python.parse("A\n"), self.symbol.stmt) self.cstbuilder.build_cst(self.symbol.file_input, stmt) stmt = find_node(self.python.parse("A\n"), self.symbol.atom)
class TestCSTBuilderTestlist(unittest.TestCase): def setUp(self): import langscape self.python = langscape.load_langlet("python") self.cstbuilder = CSTBuilder(self.python) self.symbol = self.python.parse_symbol self.token = self.python.parse_token def test_testlist(self): node = find_node(self.python.parse("A, B\n"), self.symbol.testlist) self.cstbuilder.build_cst(self.symbol.testlist, node) def test_expr(self): node = find_node(self.python.parse("A\n"), self.symbol.expr) self.cstbuilder.build_cst(self.symbol.testlist, node) def test_number(self): self.cstbuilder.build_cst(self.symbol.testlist, "1") def test_string(self): self.cstbuilder.build_cst(self.symbol.testlist, '"1"') def test_number_sequence(self): self.cstbuilder.build_cst(self.symbol.testlist, "1", "3")
def _create_cstbuilder(self): build_cstbuilder = loader.load_cstbuilder(self.package) builder = CSTBuilder(self) return build_cstbuilder(builder)
def setUp(self): import langscape self.langlet = langscape.load_langlet("gallery") self.cstbuilder = CSTBuilder(self.langlet) self.symbol = self.langlet.parse_symbol self.token = self.langlet.parse_token
def setUp(self): import langscape self.python = langscape.load_langlet("python") self.cstbuilder = CSTBuilder(self.python) self.symbol = self.python.parse_symbol self.token = self.python.parse_token
def setUp(self): import langscape self.p4d = langscape.load_langlet("p4d") self.cstbuilder = CSTBuilder(self.p4d) self.symbol = self.p4d.parse_symbol self.token = self.p4d.parse_token