hamcrest / PyHamcrest

Hamcrest matchers for Python
http://hamcrest.org/
Other
766 stars 111 forks source link

equal_to describes itself incompletely #217

Open exarkun opened 2 years ago

exarkun commented 2 years ago

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 commented 2 years ago

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.