Esempio n. 1
0
 def test_can_specify_custom_message(self):
     exception = assert_raises(AssertionError, lambda: assert_larger_than(1, 4, message='fnord'))
     assert_equals('fnord', exception_message(exception))
Esempio n. 2
0
 def test_has_sensible_default_error_message(self):
     exception = assert_raises(AssertionError, lambda: assert_true('fnord'))
     assert_equals("True != 'fnord'", exception_message(exception))
Esempio n. 3
0
 def test_has_sensible_default_error_message(self):
     exception = assert_raises(AssertionError, lambda: assert_larger_than(1, 4))
     assert_equals('1 is not larger than 4', exception_message(exception))
Esempio n. 4
0
 def test_can_specify_custom_message(self):
     failure = assert_raises(AssertionError, lambda: assert_equals(1, 2, message='fnord'))
     assert_equals('fnord', exception_message(failure))
Esempio n. 5
0
 def test_has_sensible_default_error_message(self):
     assertion = lambda: assert_dict_contains(
         dict(definitely_missing='from other dict'), dict())
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'definitely_missing':'from other dict' not in {}",
                   exception_message(exception))
Esempio n. 6
0
 def test_can_specify_custom_message(self):
     try:
         assert_raises(self.BarError, lambda: None, message='fnord')
     except AssertionError, exception:
         assert_equals('fnord', exception_message(exception))
Esempio n. 7
0
 def test_accepts_two_equal_values(self):
     assert_equals(None, None)
     assert_equals({}, {})
     assert_equals(42, 42)
Esempio n. 8
0
 def test_can_specify_custom_message(self):
     exception = assert_raises(
         AssertionError, lambda: assert_larger_than(1, 4, message='fnord'))
     assert_equals('fnord', exception_message(exception))
Esempio n. 9
0
 def test_uses_sensible_default_error_message(self):
     failure = assert_raises(AssertionError, lambda: assert_contains(1, []))
     assert_equals('1 not in []', exception_message(failure))
Esempio n. 10
0
 def test_has_sensible_default_error_message(self):
     exception = assert_raises(AssertionError, lambda: assert_true('fnord'))
     assert_equals("True != 'fnord'", exception_message(exception))
Esempio n. 11
0
 def test_has_sensible_default_error_message(self):
     exception = assert_raises(AssertionError,
                               lambda: assert_larger_than(1, 4))
     assert_equals('1 is not larger than 4', exception_message(exception))
Esempio n. 12
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. 13
0
 def test_can_specify_custom_message(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'),
                                              dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}",
                   exception_message(exception))
Esempio n. 14
0
 def test_has_sensible_default_error_message_when_values_differ(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'),
                                              dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}",
                   exception_message(exception))
Esempio n. 15
0
 def test_has_sensible_default_error_message(self):
     exception = assert_raises(AssertionError, lambda: assert_is_empty((1,)))
     assert_equals('(1,) is not empty', exception_message(exception))
Esempio n. 16
0
 def test_has_sensible_default_error_message(self):
     assertion = lambda: assert_dict_contains(dict(definitely_missing='from other dict'), dict())
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'definitely_missing':'from other dict' not in {}", exception_message(exception))
Esempio n. 17
0
 def test_can_specify_custom_message(self):
     exception = assert_raises(AssertionError, lambda: assert_is_empty((1,), message='fnord'))
     assert_equals('fnord', exception_message(exception))
Esempio n. 18
0
 def test_has_sensible_default_error_message_when_values_differ(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'), dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}", exception_message(exception))
Esempio n. 19
0
 def test_uses_sensible_default_error_message(self):
     try:
         assert_raises(self.BarError, lambda: None)
     except AssertionError, exception:
         assert_equals('BarError not raised', exception_message(exception))
Esempio n. 20
0
 def test_can_specify_custom_message(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'), dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}", exception_message(exception))
Esempio n. 21
0
 def test_raises_on_different_values(self):
     assert_raises(AssertionError, lambda: assert_equals(1, 2))
     assert_raises(AssertionError, lambda: assert_equals(None, 2))
Esempio n. 22
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. 23
0
 def test_uses_sensible_default_error_message(self):
     failure = assert_raises(AssertionError, lambda: assert_equals(1, 2))
     assert_equals('1 != 2', exception_message(failure))
Esempio n. 24
0
 def test_uses_sensible_default_error_message(self):
     failure = assert_raises(AssertionError, lambda: assert_contains(1, []))
     assert_equals('1 not in []', exception_message(failure))