I tried out pyHamcrest (which is hamcrest for python, obviously) and almost immediately fell in love with it. Writing assertions using it means typing somewhat more code, but in the end results are much nicer.
Old style of writing assertions is somewhat like:
assert len(sections) > 3
With Hamcrest, I would write it:
So, more code, but somewhat closer to natural language than in the first way. Where the Hamcrest shines is reporting failures though. Instead of old: assertation failed message, you get following:
Expected: an object with length of a value greater than <3> but: was [obj at 0x01…] with length of <1>”
So, it tells you what was expected, what was the real result and why it didn’t match to the expected result. Extracting that error and presenting it on a report is actually useful and gives to even to a non-programmer an idea why the test case was reported as a failure.