Esempio n. 1
0
 def test_can_specify_custom_failure_exception(self):
     assert_raises(FooError, lambda: assert_smaller_than(4, 1, failure_exception=FooError))
Esempio n. 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))
Esempio n. 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))
Esempio n. 4
0
 def test_accepts_smaller_values(self):
     assert_smaller_than(1, 4)
     assert_smaller_than(-20, -5)
Esempio n. 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))
Esempio n. 6
0
 def test_can_specify_custom_failure_exception(self):
     assert_raises(
         FooError,
         lambda: assert_smaller_than(4, 1, failure_exception=FooError))
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 10
0
 def test_accepts_smaller_values(self):
     assert_smaller_than(1, 4)
     assert_smaller_than(-20, -5)