Skip to content

Describe the equality comparison in explicit equal_to matchers - #341

Open
Boulea7 wants to merge 1 commit into
hamcrest:mainfrom
Boulea7:describe-equal-to-matcher
Open

Boulea7 wants to merge 1 commit into
hamcrest:mainfrom
Boulea7:describe-equal-to-matcher

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #217.

StringDescription now describes equal_to(3) as a value equal to <3>. This makes the comparison visible when a matcher is displayed on its own or inside a compound expression. For example, any_of(equal_to(3), greater_than(4)) now reads (a value equal to <3> or a value greater than <4>).

Matchers that implicitly wrap literal values keep their existing descriptions. An assertion such as assert_that(value, equal_to(3)) includes the comparison on the Expected line and still describes the actual value as was …. Compound matchers that include a child matcher in their mismatch message also show the comparison there.

The tests cover explicit and implicit comparisons, nested matchers and the stored state used by earlier releases. I also checked the diagnostics from a real Behave feature against PyHamcrest 2.1.0 and the candidate.

@Boulea7
Boulea7 requested a deployment to publish-test-release December 3, 2026 06:38 — with GitHub Actions Waiting

This branch is waiting to be deployed

1 waiting deployment
publish-test-release — f857983d Waiting Dec 3, 2026 by Boulea7 via Publish in-dev package to test.pypi.org #333
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.

equal_to describes itself incompletely

1 participant