Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equal_to describes itself incompletely #217

Open
exarkun opened this issue Aug 24, 2022 · 1 comment
Open

equal_to describes itself incompletely #217

exarkun opened this issue Aug 24, 2022 · 1 comment

Comments

@exarkun
Copy link

exarkun commented Aug 24, 2022

Consider how equal_to describes itself:

>>> d = StringDescription()
>>> d.append_description_of(equal_to(3))
<hamcrest.core.string_description.StringDescription object at 0x7fd8de172c40>
>>> str(d)
'<3>'

What does <3> mean? It's hard to tell. Compare this with other built-in matcher self-descriptions:

>>> d = StringDescription()
>>> d.append_description_of(greater_than(3))
<hamcrest.core.string_description.StringDescription object at 0x7fd8de0c0d90>
>>> str(d)
'a value greater than <3>'
@brunns
Copy link
Collaborator

brunns commented Aug 25, 2022

The message as-is tends to make more sense in the most common scenario of an assert_that() message, but that's not the only intended usage for matchers, so I think I'd be happy to make this more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants