MCPcopy Index your code
hub / github.com/python/cpython / do_approx_equal_abs_test

Method do_approx_equal_abs_test

Lib/test/test_statistics.py:476–481  ·  view source on GitHub ↗
(self, x, delta)

Source from the content-addressed store, hash-verified

474 # === Absolute error tests ===
475
476 def do_approx_equal_abs_test(self, x, delta):
477 template = "Test failure for x={!r}, y={!r}"
478 for y in (x + delta, x - delta):
479 msg = template.format(x, y)
480 self.assertTrue(approx_equal(x, y, tol=2*delta, rel=0), msg)
481 self.assertFalse(approx_equal(x, y, tol=delta/2, rel=0), msg)
482
483 def test_approx_equal_absolute_ints(self):
484 # Test approximate equality of ints with an absolute error.

Calls 4

approx_equalFunction · 0.85
assertTrueMethod · 0.80
assertFalseMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected