function(1)
try:
    function(0)
except AssertionError:
    pass
else:
    assert 0, 'never happens'
c = C()
c.method_success()
try:
    c.method_fail()
except AssertionError:
    pass
else:
    assert 0, 'never happens'
Python @precondition / @postcondition для функции-члена — как?