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

Method test_nonnumeric_false_if_unequal

testing/python/approx.py:799–811  ·  view source on GitHub ↗

For nonnumeric types, x != pytest.approx(y) reduces to x != y

(self, x)

Source from the content-addressed store, hash-verified

797 ],
798 )
799 def test_nonnumeric_false_if_unequal(self, x):
800 """For nonnumeric types, x != pytest.approx(y) reduces to x != y"""
801 assert "ab" != approx("abc")
802 assert ["ab"] != approx(["abc"])
803 # in particular, both of these should return False
804 assert {"a": 1.0} != approx({"a": None})
805 assert {"a": None} != approx({"a": 1.0})
806
807 assert 1.0 != approx(None)
808 assert None != approx(1.0) # noqa: E711
809
810 assert 1.0 != approx([None])
811 assert None != approx([1.0]) # noqa: E711
812
813 @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires ordered dicts")
814 def test_nonnumeric_dict_repr(self):

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected