class TestStringsParser(unittest.TestCase): def setUp(self): lexer = MockLexer() self.parser = StringsParser(lexer) def testParse(self): tree = self.parser.parse() self.assertEquals(tree.entries[0].key, 'key') self.assertEquals(tree.entries[0].value, 'value')
def setUp(self): lexer = MockLexer() self.parser = StringsParser(lexer)
def make_ast(path): with open(path, 'rb') as f: source = f.read() lexer = StringsLexer(source) parser = StringsParser(lexer) return parser.parse()