Пример #1
0
 def test_can_specify_custom_failure_exception(self):
     assert_raises(FooError, lambda: assert_smaller_than(4, 1, failure_exception=FooError))
Пример #2
0
 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))
Пример #3
0
 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))
Пример #4
0
 def test_accepts_smaller_values(self):
     assert_smaller_than(1, 4)
     assert_smaller_than(-20, -5)
Пример #5
0
 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))
Пример #6
0
 def test_can_specify_custom_failure_exception(self):
     assert_raises(
         FooError,
         lambda: assert_smaller_than(4, 1, failure_exception=FooError))
Пример #7
0
 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))
Пример #8
0
 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))
Пример #9
0
 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))
Пример #10
0
 def test_accepts_smaller_values(self):
     assert_smaller_than(1, 4)
     assert_smaller_than(-20, -5)