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

Method test_inf_tolerance

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

Source from the content-addressed store, hash-verified

385 0 == approx(1, rel=-3)
386
387 def test_inf_tolerance(self):
388 # Everything should be equal if the tolerance is infinite.
389 large_diffs = [(1, 1000), (1e-50, 1e50), (-1.0, -1e300), (0.0, 10)]
390 for a, x in large_diffs:
391 assert a != approx(x, rel=0.0, abs=0.0)
392 assert a == approx(x, rel=inf, abs=0.0)
393 assert a == approx(x, rel=0.0, abs=inf)
394 assert a == approx(x, rel=inf, abs=inf)
395
396 def test_inf_tolerance_expecting_zero(self) -> None:
397 # If the relative tolerance is zero but the expected value is infinite,

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected