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)
def test_syntax_error(expression): with pytest.raises(JSONPathSyntaxError): parse(expression)
def test_undefined_function_error(): with pytest.raises(JSONPathUndefinedFunctionError): parse("$[abc(@)]")
def test_parse_and_extract(expression, data, expect): jp = parse(expression) logging.debug(f"parse {expression!r} result: {jp}") assert jp.find(data) == expect