Skip to content

Commit eda8288

Browse files
authored
Merge pull request #66 from jg-rp/skip-bad-hexchars
Skip tests for invalid `\u` escape sequences
2 parents fe58ebe + d0cc519 commit eda8288

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- 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).
88

9+
**Compliance**
10+
11+
- 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).
12+
913
**Features**
1014

1115
- 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).

docs/syntax.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ And this is a list of areas where we deviate from [RFC 9535](https://datatracker
213213
- By default, `and` is equivalent to `&&` and `or` is equivalent to `||`.
214214
- `none` and `nil` are aliases for `null`.
215215
- `null` (and its aliases), `true` and `false` can start with an upper or lower case letter.
216+
- 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.
216217

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

tests/cts

tests/test_compliance.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ class Case:
4444
"functions, search, filter, search function, unicode char class, uppercase": "\\p not supported", # noqa: E501
4545
"functions, search, filter, search function, unicode char class negated, uppercase": "\\P not supported", # noqa: E501
4646
"filter, equals number, decimal fraction, no fractional digit": "TODO",
47+
"name selector, double quotes, single high surrogate": "expected behavior policy",
48+
"name selector, double quotes, single low surrogate": "expected behavior policy",
49+
"name selector, double quotes, high high surrogate": "expected behavior policy",
50+
"name selector, double quotes, low low surrogate": "expected behavior policy",
51+
"name selector, double quotes, surrogate non-surrogate": "expected behavior policy",
4752
"whitespace, selectors, space between dot and name": "flexible whitespace policy", # noqa: E501
4853
"whitespace, selectors, newline between dot and name": "flexible whitespace policy", # noqa: E501
4954
"whitespace, selectors, tab between dot and name": "flexible whitespace policy", # noqa: E501

0 commit comments

Comments
 (0)