Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/20/cql json like #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pygeofilter/parsers/cql_json/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ def walk_cql_json(node: dict, is_temporal: bool = False) -> ast.Node:

elif name == 'like':
return ast.Like(
walk_cql_json(value['like'][0]),
value['like'][1],
nocase=value.get('nocase', True),
wildcard=value.get('wildcard', '%'),
singlechar=value.get('singleChar', '.'),
escapechar=value.get('escapeChar', '\\'),
walk_cql_json(value[0]),
value[1],
nocase=node.get('nocase', True),
wildcard=node.get('wildcard', '%'),
singlechar=node.get('singleChar', '.'),
escapechar=node.get('escapeChar', '\\'),
not_=False,
)

Expand Down
24 changes: 10 additions & 14 deletions tests/parsers/cql_json/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ def test_attribute_between_negative_positive():

def test_string_like():
result = parse({
"like": {
"like": [
{"property": "attr"},
"some%",
],
"nocase": False,
}
"like": [
{"property": "attr"},
"some%",
],
"nocase": False,
})
assert result == ast.Like(
ast.Attribute('attr'),
Expand All @@ -161,13 +159,11 @@ def test_string_like():

def test_string_ilike():
result = parse({
"like": {
"like": [
{"property": "attr"},
"some%",
],
"nocase": True,
}
"like": [
{"property": "attr"},
"some%",
],
"nocase": True,
})
assert result == ast.Like(
ast.Attribute('attr'),
Expand Down