Skip to content

Commit eb24c54

Browse files
committed
Allow nested filters.
1 parent d9c9ace commit eb24c54

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Raise a `JSONPathIndexError` if an index selector is out of range.
2424
- Raise a `JSONPathSyntaxError` for too many colons in a slice selector.
2525
- Raise a `JSONPathIndexError` if a slice selector argument is out of range.
26+
- Allow nested filters.
2627

2728
## Version 0.4.0
2829

jsonpath/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def parse_path(
285285
)
286286
elif stream.current.kind == TOKEN_LIST_START:
287287
yield self.parse_selector_list(stream)
288-
elif stream.current.kind == TOKEN_FILTER_START and not in_filter:
288+
elif stream.current.kind == TOKEN_FILTER_START:
289289
yield self.parse_filter(stream)
290290
else:
291291
if in_filter:

tests/compliance.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class Case:
3535

3636

3737
SKIP = {
38-
"filter, nested": "not supported",
3938
"no leading whitespace": "flexible whitespace policy",
4039
"no trailing whitespace": "flexible whitespace policy",
4140
}

tests/test_ietf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ class Case:
171171
{"p": 1, "q": 2, "r": 3, "s": 5, "t": {"u": 6}},
172172
],
173173
),
174-
# Case(
175-
# description="filter selector - Nested filters",
176-
# path="$[?(@[?(@.b)])] ",
177-
# data=FILTER_SELECTOR_DATA,
178-
# want=[[3, 5, 1, 2, 4, 6, {"b": "j"}, {"b": "k"}, {"b": {}}, {"b": "kilo"}]],
179-
# ),
174+
Case(
175+
description="filter selector - Nested filters",
176+
path="$[?(@[?(@.b)])] ",
177+
data=FILTER_SELECTOR_DATA,
178+
want=[[3, 5, 1, 2, 4, 6, {"b": "j"}, {"b": "k"}, {"b": {}}, {"b": "kilo"}]],
179+
),
180180
Case(
181181
description="filter selector - Array value logical OR",
182182
path='$.a[?(@<2 || @.b == "k")]',

0 commit comments

Comments
 (0)