def test_passes_if_values_are_equal_within_max_delta(self): assert_almost_equals(1, 1, max_delta=1) assert_almost_equals(1, 2, max_delta=1) now = datetime.now() one_hour_ago = now - timedelta(hours=1) assert_almost_equals(now, one_hour_ago, max_delta=timedelta(hours=2))
def assert_fail(self, expected, actual, max_delta=None, message=None): assertion = lambda: assert_almost_equals(expected, actual, max_delta=max_delta, message=message) return assert_raises(AssertionError, assertion)
def test_passes_if_values_are_equal(self): assert_almost_equals(1, 1) assert_almost_equals('foo', 'foo')
def assert_fail(self, expected, actual, max_delta=None, message=None): assertion = lambda: assert_almost_equals( expected, actual, max_delta=max_delta, message=message) return assert_raises(AssertionError, assertion)