Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariana Barzinpour committed Mar 28, 2024
1 parent 5b9b3cf commit 37d86ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions pygeofilter/parsers/cql2_json/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ def walk_cql_json(node: JsonType): # noqa: C901
return ast.Not(cast(ast.Node, walk_cql_json(args)))

elif op == "isNull":
return ast.IsNull(cast(ast.Node, walk_cql_json(args)), False)
# like with "not", allow both arrays and objects
if isinstance(args, list):
args = args[0]
return ast.IsNull(cast(ast.Node, walk_cql_json(args)), not_=False)

elif op == "between":
return ast.Between(
Expand Down Expand Up @@ -153,12 +156,6 @@ def walk_cql_json(node: JsonType): # noqa: C901
not_=False,
)

elif op == "isNull":
return ast.IsNull(
walk_cql_json(args),
not_=False,
)

elif op in BINARY_OP_PREDICATES_MAP:
args = [cast(ast.Node, walk_cql_json(arg)) for arg in args]
return BINARY_OP_PREDICATES_MAP[op](*args)
Expand Down
2 changes: 1 addition & 1 deletion tests/parsers/cql2_json/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_attribute_in_list():


def test_attribute_is_null():
result = parse({"op": "isNull", "args": {"property": "attr"}})
result = parse({"op": "isNull", "args": [{"property": "attr"}]})
assert result == ast.IsNull(ast.Attribute("attr"), False)


Expand Down

0 comments on commit 37d86ac

Please sign in to comment.