Skip to content

Commit 598ae6a

Browse files
author
rsmith013
committed
refactored LIKE predicate and test. closes #20
1 parent 196b2ff commit 598ae6a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

pygeofilter/parsers/cql_json/parser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ def walk_cql_json(node: dict, is_temporal: bool = False) -> ast.Node:
159159

160160
elif name == 'like':
161161
return ast.Like(
162-
walk_cql_json(value['like'][0]),
163-
value['like'][1],
164-
nocase=value.get('nocase', True),
165-
wildcard=value.get('wildcard', '%'),
166-
singlechar=value.get('singleChar', '.'),
167-
escapechar=value.get('escapeChar', '\\'),
162+
walk_cql_json(value[0]),
163+
value[1],
164+
nocase=node.get('nocase', True),
165+
wildcard=node.get('wildcard', '%'),
166+
singlechar=node.get('singleChar', '.'),
167+
escapechar=node.get('escapeChar', '\\'),
168168
not_=False,
169169
)
170170

tests/parsers/cql_json/test_parser.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ def test_attribute_between_negative_positive():
140140

141141
def test_string_like():
142142
result = parse({
143-
"like": {
144-
"like": [
143+
"like": [
145144
{"property": "attr"},
146145
"some%",
147146
],
148147
"nocase": False,
149-
}
150-
})
148+
})
151149
assert result == ast.Like(
152150
ast.Attribute('attr'),
153151
'some%',

0 commit comments

Comments
 (0)