Skip to content

Compare variable set contents instead of any overlap - #166

Open
hakarrr wants to merge 2 commits into
python-hyper:mainfrom
hakarrr:main
Open

hakarrr wants to merge 2 commits into
python-hyper:mainfrom
hakarrr:main

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 24, 2026

Copy link
Copy Markdown

variables("{a}") == {"a", "b"} currently returns True, and variables("") == set() returns False. Equality with a non-OrderedSet operand uses not isdisjoint(), so it checks for any shared member rather than equal contents. The same problem affects URITemplate.variable_names.

Compare set contents for these operands. OrderedSet-to-OrderedSet comparisons keep their existing order-sensitive behavior, and iterable operands remain supported.

Added three regression methods covering built-in sets/frozensets in both operand orders, empty/disjoint/overlapping sets, ordered comparisons, lists, tuples and iterators. Eleven subtests fail on the unmodified base. An exhaustive 256-pair subset oracle also passes in both directions.

Validation on Linux:

  • Full suite: 61 tests pass on CPython 3.9, 3.10, 3.11 and 3.12. Python 3.10-3.12 additionally report all 93 unittest subtests passing; Python 3.9 runs them without a separate pytest count.
  • Combined line/branch coverage: 92%.
  • Black, Flake8, isort, strict Mypy and applicable configured pre-commit hooks pass.
  • Wheel/sdist build and git diff checks pass.

Python 3.13/3.14 and other operating systems were not run locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant