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

Skip tests for invalid \u escape sequences #66

Merged
merged 2 commits into from
Aug 4, 2024
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Fixed handling of JSONPath literals in filter expressions. We now raise a `JSONPathSyntaxError` if a filter expression literal is not part of a comparison, membership or function expression. See [jsonpath-compliance-test-suite#81](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite/pull/81).

**Compliance**

- Skipped tests for invalid escape sequences. The JSONPath spec is more strict than Python's JSON decoder when it comes to parsing `\u` escape sequences in string literals. We are adopting a policy of least surprise. The assertion is that most people will expect the JSONPath parser to behave the same as Python's JSON parser. See [jsonpath-compliance-test-suite #87](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite/pull/87).

**Features**

- Allow JSONPath filter expression membership operators (`contains` and `in`) to operate on object/mapping data as well as arrays/sequences. See [#55](https://github.com/jg-rp/python-jsonpath/issues/55).
Expand Down
1 change: 1 addition & 0 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ And this is a list of areas where we deviate from [RFC 9535](https://datatracker
- By default, `and` is equivalent to `&&` and `or` is equivalent to `||`.
- `none` and `nil` are aliases for `null`.
- `null` (and its aliases), `true` and `false` can start with an upper or lower case letter.
- We don't treat some invalid `\u` escape sequences in quoted name selectors and string literals as an error. We match the behavior of the JSON decoder in Python's standard library, which is less strict than RFC 9535.

And this is a list of features that are uncommon or unique to Python JSONPath.

Expand Down
2 changes: 1 addition & 1 deletion tests/cts
Submodule cts updated 2 files
+45 −0 cts.json
+45 −0 tests/name_selector.json
5 changes: 5 additions & 0 deletions tests/test_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class Case:
"functions, search, filter, search function, unicode char class, uppercase": "\\p not supported", # noqa: E501
"functions, search, filter, search function, unicode char class negated, uppercase": "\\P not supported", # noqa: E501
"filter, equals number, decimal fraction, no fractional digit": "TODO",
"name selector, double quotes, single high surrogate": "expected behavior policy",
"name selector, double quotes, single low surrogate": "expected behavior policy",
"name selector, double quotes, high high surrogate": "expected behavior policy",
"name selector, double quotes, low low surrogate": "expected behavior policy",
"name selector, double quotes, surrogate non-surrogate": "expected behavior policy",
"whitespace, selectors, space between dot and name": "flexible whitespace policy", # noqa: E501
"whitespace, selectors, newline between dot and name": "flexible whitespace policy", # noqa: E501
"whitespace, selectors, tab between dot and name": "flexible whitespace policy", # noqa: E501
Expand Down
Loading