MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_relative_tolerance

Method test_relative_tolerance

testing/python/approx.py:452–456  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

450 assert 1e-8 + 1e-16 != approx(1e-8, rel=5e-9, abs=5e-17)
451
452 def test_relative_tolerance(self):
453 within_1e8_rel = [(1e8 + 1e0, 1e8), (1e0 + 1e-8, 1e0), (1e-8 + 1e-16, 1e-8)]
454 for a, x in within_1e8_rel:
455 assert a == approx(x, rel=5e-8, abs=0.0)
456 assert a != approx(x, rel=5e-9, abs=0.0)
457
458 def test_absolute_tolerance(self):
459 within_1e8_abs = [(1e8 + 9e-9, 1e8), (1e0 + 9e-9, 1e0), (1e-8 + 9e-9, 1e-8)]

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected