Example #1
0
def test_parser_parse(patch, parser):
    """
    Ensures the build method can build the grammar
    """
    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()
Example #2
0
def test_parser_parse(patch, parser):
    """
    Ensures the build method can build the grammar
    """
    patch.many(Parser, ["transformer"])
    result = parser.parse("source", allow_single_quotes=False)
    parser.lark.parse.assert_called_with("source\n")
    Parser.transformer().transform.assert_called_with(parser.lark.parse())
    assert result == Parser.transformer().transform()
Example #3
0
def test_parser_transfomer(patch):
    patch.init(Transformer)
    result = Parser.transformer(allow_single_quotes=False)
    assert isinstance(result, Transformer)
Example #4
0
def test_parser_transfomer(patch):
    patch.init(Transformer)
    result = Parser.transformer()
    assert isinstance(result, Transformer)