Repository navigation
Match namespace-wildcard attribute values individually - #207
Merged
wRAR merged 1 commit intoOct 20, 2026
Merged
Conversation
AdrianAtZyte
approved these changes
Oct 19, 2026
Contributor
There was a problem hiding this comment.
Please, trim the tests down: a few
xpath()assertions next to the existinge[*|foo]one (e.g.^=,=withi, and an empty value) plus a single small document-based test showing the second attribute matching would cover it. The loops over every operator × flag × order, and the:not()/:is()/:has()and non-ASCII cases, test things that are not specific to this change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #207 +/- ##
=======================================
Coverage 99.79% 99.79%
=======================================
Files 3 3
Lines 987 994 +7
Branches 162 164 +2
=======================================
+ Hits 985 992 +7
Misses 1 1
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wRAR
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a namespace-wildcard attribute selector matches more than one attribute on an XML element, XPath 1.0 string functions inspect only the first attribute. For example,
[*|label^="prefix"]misses<item a:label="other" b:label="prefix-token"/>. Matching depends on attribute order; ASCII case-insensitive equality has the same problem.Apply standard value comparisons in a predicate on each matching attribute, then test whether any attribute remains. Regression tests cover all six standard value operators, attribute order, namespaced and unnamespaced attributes, case flags, empty values, and combinations with
:not(),:is()and:has(). Presence selectors and the nonstandard!=operator keep their existing translation.Validation in an isolated environment on Windows/CPython 3.12.8:
xpath.pyhas 100% statement and branch coverage.The full platform/Python matrix and hosted CI have not been run.