def test_can_specify_custom_failure_exception(self): assert_raises(FooError, lambda: assert_smaller_than(4, 1, failure_exception=FooError))
def test_has_sensible_default_error_message(self): exception = assert_raises(AssertionError, lambda: assert_smaller_than(4, 1)) assert_equals('4 is not smaller than 1', exception_message(exception))
def test_can_specify_custom_message(self): exception = assert_raises(AssertionError, lambda: assert_smaller_than(4, 1, message='fnord')) assert_equals('fnord', exception_message(exception))
def test_accepts_smaller_values(self): assert_smaller_than(1, 4) assert_smaller_than(-20, -5)
def test_raises_if_value_is_not_smaller(self): assert_raises(AssertionError, lambda: assert_smaller_than(1, 1)) assert_raises(AssertionError, lambda: assert_smaller_than(4, 1)) assert_raises(AssertionError, lambda: assert_smaller_than(-4, -5))
def test_can_specify_custom_failure_exception(self): assert_raises( FooError, lambda: assert_smaller_than(4, 1, failure_exception=FooError))
def test_can_specify_custom_message(self): exception = assert_raises( AssertionError, lambda: assert_smaller_than(4, 1, message='fnord')) assert_equals('fnord', exception_message(exception))