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))
def test_has_sensible_default_error_message(self): exception = assert_raises(AssertionError, lambda: assert_true('fnord')) assert_equals("True != 'fnord'", exception_message(exception))
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))
def test_can_specify_custom_message(self): failure = assert_raises(AssertionError, lambda: assert_equals(1, 2, message='fnord')) assert_equals('fnord', exception_message(failure))
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))
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))
def test_accepts_two_equal_values(self): assert_equals(None, None) assert_equals({}, {}) assert_equals(42, 42)
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))
def test_uses_sensible_default_error_message(self): failure = assert_raises(AssertionError, lambda: assert_contains(1, [])) assert_equals('1 not in []', exception_message(failure))
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): 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))
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))
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))
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))
def test_can_specify_custom_message(self): exception = assert_raises(AssertionError, lambda: assert_is_empty((1,), message='fnord')) assert_equals('fnord', exception_message(exception))
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))
def test_raises_on_different_values(self): assert_raises(AssertionError, lambda: assert_equals(1, 2)) assert_raises(AssertionError, lambda: assert_equals(None, 2))
def test_uses_sensible_default_error_message(self): failure = assert_raises(AssertionError, lambda: assert_equals(1, 2)) assert_equals('1 != 2', exception_message(failure))