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

Method do_approx_equal_rel_test

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

Source from the content-addressed store, hash-verified

515 # === Relative error tests ===
516
517 def do_approx_equal_rel_test(self, x, delta):
518 template = "Test failure for x={!r}, y={!r}"
519 for y in (x*(1+delta), x*(1-delta)):
520 msg = template.format(x, y)
521 self.assertTrue(approx_equal(x, y, tol=0, rel=2*delta), msg)
522 self.assertFalse(approx_equal(x, y, tol=0, rel=delta/2), msg)
523
524 def test_approx_equal_relative_ints(self):
525 # Test approximate equality of ints with a relative error.

Calls 4

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

Tested by

no test coverage detected