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