exam
exam copied to clipboard
Usage of `assertDoesNotChange` with `before` or `after` parameters results in confusing error message.
Any combination of usage of before or after parameters results in an error, for example:
Traceback (most recent call last):
File "example.py", line 10, in test_assertdoesnotchange_after
with self.assertDoesNotChange(lambda: 0, before=0):
File "/Users/ted/.virtualenvs/eaxm/lib/python2.7/site-packages/exam/asserts.py", line 33, in __enter__
assert not check, message.format(**vars(self))
AssertionError: Value before is 0, not 0
This prevents being able to use the before or after keyword (or both) as a shorter form of the assertion:
value = 0
with self.assertDoesNotChange(lambda: value):
assert value == 0