Skip to content

Conversation

@patchback
Copy link

@patchback patchback bot commented Jan 25, 2026

This is a backport of PR #13815 as merged into main (e95a843).

Hello,

This PR fixes an issue with pytest.approx where the error message incorrectly reported all elements as mismatched when comparing mappings with different key orders, even when only some values differed.

The original code paired values by position rather than by key. This caused incorrect mismatch reporting when dictionary keys were in different orders.

This closes #12444.

Checklist

  • I have included new tests or updated existing ones where applicable.
  • I have created a new changelog file in the changelog folder, named <ISSUE NUMBER>.<TYPE>.rst.
  • I have added myself to AUTHORS in alphabetical order.
  • I have added text like “closes #XYZW” to the PR description.
  • I have allowed maintainers to push and squash when merging my commits.
  • I have included documentation when adding new features. (Not applicable here – this is a bug fix.)

…pare them (#13815)

This fixes an issue with `pytest.approx` where the error message incorrectly reported all elements as mismatched when comparing mappings with different key orders, even when only some values differed.

The original code paired values by position rather than by key. This caused incorrect mismatch reporting when dictionary keys were in different orders.

Fixes #12444

(cherry picked from commit e95a843)
@nicoddemus nicoddemus enabled auto-merge (squash) January 25, 2026 13:02
@nicoddemus nicoddemus merged commit 72ae54c into 9.0.x Jan 25, 2026
33 checks passed
@nicoddemus nicoddemus deleted the patchback/backports/9.0.x/e95a843a5dbf8af618d0714705bbf97dfdb04044/pr-13815 branch January 25, 2026 13:23
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.

3 participants