wish for invertible matchers
Bug #704219 reported by
Martin Pool
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
I can define ContainsRegexp(
"unexpectedly matched '\\d+' in 'route66' at '66'"
rather than just being told the matcher passed successfully.
I can just define NotContainsRegexp that has the same behavior but gives better mismatches. But I wonder if this should fall out in a cleaner way.
Changed in testtools: | |
status: | New → Triaged |
importance: | Undecided → Wishlist |
tags: | added: matchers |
To post a comment you must log in.
One idea on this:
Perhaps what I want is assertThat() to be a HOF that takes an
expression and evaluates it. If it evaluates to False, it will
display as much information is as is possible/useful about the
expression and its evaluation, so that we can understand the failure
without having to reproduce it or break into it with a debugger.
The problem with a crude Not that is simply given the evaluated value
of the inner expression is that it cannot say anything more about that
expression if it fails. However, if we instead printed the inner
expression including the variable bindings, then it would probably be
clear why there was a problem.