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()
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()
def test_parser_transfomer(patch): patch.init(Transformer) result = Parser.transformer(allow_single_quotes=False) assert isinstance(result, Transformer)
def test_parser_transfomer(patch): patch.init(Transformer) result = Parser.transformer() assert isinstance(result, Transformer)