def test_decorate_with_custom_assertion(self): def be_5(this): this._assert( action=lambda: this._value == 5, report=lambda: "'{0}' should equal '5'.".format(this._value) ) should_expectation(be_5) self._passes(lambda: this(5).should.be_5()) self._fails(lambda: this(4).should.be_5(), "'4' should equal '5'.")
def test_decorate_with_custom_assertion(self): def be_5(this): this._assert( action=lambda: this._value == 5, report=lambda: "'{0}' should equal '5'.".format(this._value) ) should_expectation(be_5) this(5).should.be_5() with self.assertRaises(AssertionError): this(4).should.be_5()