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

Method test_dict

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

Source from the content-addressed store, hash-verified

584 assert 1 != approx((1,))
585
586 def test_dict(self):
587 actual = {"a": 1 + 1e-7, "b": 2 + 1e-8}
588 # Dictionaries became ordered in python3.6, so switch up the order here
589 # to make sure it doesn't matter.
590 expected = {"b": 2, "a": 1}
591
592 # Return false if any element is outside the tolerance.
593 assert actual == approx(expected, rel=5e-7, abs=0)
594 assert actual != approx(expected, rel=5e-8, abs=0)
595 assert approx(expected, rel=5e-7, abs=0) == actual
596 assert approx(expected, rel=5e-8, abs=0) != actual
597
598 def test_dict_decimal(self):
599 actual = {"a": Decimal("1.000001"), "b": Decimal("2.000001")}

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected