Пример #1
0
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')
Пример #2
0
 def setUp(self):
     lexer = MockLexer()
     self.parser = StringsParser(lexer)
Пример #3
0
def make_ast(path):
    with open(path, 'rb') as f:
        source = f.read()
    lexer = StringsLexer(source)
    parser = StringsParser(lexer)
    return parser.parse()