For nonnumeric types, x != pytest.approx(y) reduces to x != y
(self, x)
| 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): |