PyHamcrest
PyHamcrest copied to clipboard
equal_to describes itself incompletely
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>'
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.