PyHamcrest icon indicating copy to clipboard operation
PyHamcrest copied to clipboard

equal_to describes itself incompletely

Open exarkun opened this issue 2 years ago • 1 comments

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>'

exarkun avatar Aug 24 '22 17:08 exarkun

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.

brunns avatar Aug 25 '22 07:08 brunns