Something like:
def assert_all(*assertions):
assertion_failed = False
assertion_message = []
for (actual, matcher) in assertions:
try:
hamcrest.assert_that(actual, matcher)
except AssertionError as e:
assertion_failed = True
assertion_message.append(e.message)
if assertion_failed:
raise AssertionError(''.join(assertion_message))
would be great. It performs all assertions before failing so it can report on
all violations. It also allows verifying different objects (eg ensure different
files have different characteristics) and keeps the SUT and its matchers paired
for better readability.
Original issue reported on code.google.com by noel....@gmail.com on 14 May 2012 at 5:22
Original issue reported on code.google.com by
noel....@gmail.com
on 14 May 2012 at 5:22