示例#1
0
def test_parser_parse(patch, parser):
    patch.many(Parser, ['lark', 'transformer'])
    result = parser.parse('source')
    Parser.lark().parse.assert_called_with('source\n')
    Parser.transformer().transform.assert_called_with(Parser.lark().parse())
    assert result == Parser.transformer().transform()
示例#2
0
def test_parser_transformer(patch):
    patch.init(Transformer)
    result = Parser.transformer()
    assert isinstance(result, Transformer)