Skip to content

fix(jwk): handle KeySet equality with unrelated types - #106

Merged
lepture merged 2 commits into
authlib:mainfrom
janmrow:fix/keyset-equality
Sep 13, 2026
Merged

fix(jwk): handle KeySet equality with unrelated types#106
lepture merged 2 commits into
authlib:mainfrom
janmrow:fix/keyset-equality

Conversation

@janmrow

@janmrow janmrow commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

KeySet.__eq__ currently raises an exception when a KeySet is compared with an unrelated type.

This PR returns NotImplemented for unsupported types. This lets Python handle the comparison, while keeping existing KeySet-to-KeySet comparisons unchanged.

Regression tests cover comparisons with unrelated types, also including reflected equality.

Tests on local:

  • pytest tests/ -q
  • mypy src/joserfc/_keys.py

Comment thread src/joserfc/_keys.py Outdated
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.86%. Comparing base (397e04f) to head (8cf48fd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #106   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files          47       47           
  Lines        2955     2956    +1     
  Branches      352      353    +1     
=======================================
+ Hits         2951     2952    +1     
  Misses          2        2           
  Partials        2        2           
Flag Coverage Δ
unittests 99.86% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@janmrow
janmrow force-pushed the fix/keyset-equality branch from 0751c48 to 8cf48fd Compare September 12, 2026 21:01
@lepture
lepture merged commit 27d7c8a into authlib:main Sep 13, 2026
9 checks passed
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.

2 participants