示例#1
0
def test_parse_check_and_extract(expression, data, expect):
    jp = parse(expression)
    logging.debug(f"parse {expression!r} result: {jp}")
    assert jp.get_expression() == expression
    assert_find(jp, data, expect)
示例#2
0
def test_syntax_error(expression):
    with pytest.raises(JSONPathSyntaxError):
        parse(expression)
示例#3
0
def test_undefined_function_error():
    with pytest.raises(JSONPathUndefinedFunctionError):
        parse("$[abc(@)]")
示例#4
0
def test_parse_and_extract(expression, data, expect):
    jp = parse(expression)
    logging.debug(f"parse {expression!r} result: {jp}")
    assert jp.find(data) == expect