From a07fe8289f90a704c10274f73f6a6ca0af991e51 Mon Sep 17 00:00:00 2001 From: James Prior Date: Sat, 3 Aug 2024 11:25:46 +0100 Subject: [PATCH 1/2] Update CTS --- CHANGELOG.md | 4 ++++ tests/cts | 2 +- tests/test_compliance.py | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e594c..97c4ab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. That is, 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). diff --git a/tests/cts b/tests/cts index 18a5245..b11c029 160000 --- a/tests/cts +++ b/tests/cts @@ -1 +1 @@ -Subproject commit 18a52450177dad29e0c122a3e3f712c8fc4a8034 +Subproject commit b11c0290808bd7021bd0b018cbb42fa1cc60bc7c diff --git a/tests/test_compliance.py b/tests/test_compliance.py index 4c3cfa9..dcdca5c 100644 --- a/tests/test_compliance.py +++ b/tests/test_compliance.py @@ -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 From d0cc519350f0d2f47e6ba3e243152961c0015cad Mon Sep 17 00:00:00 2001 From: James Prior Date: Sat, 3 Aug 2024 11:36:22 +0100 Subject: [PATCH 2/2] docs: add to notable differences --- CHANGELOG.md | 2 +- docs/syntax.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97c4ab2..22cc84a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ **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. That is, 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). +- 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** diff --git a/docs/syntax.md b/docs/syntax.md index 2dde3eb..f247f4c 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -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.