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

Method test_unicode_plus_minus

testing/python/approx.py:747–763  ·  view source on GitHub ↗

Comparing approx instances inside lists should not produce an error in the detailed diff. Integration test for issue #2111.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

745 mocked_doctest_runner.run(test)
746
747 def test_unicode_plus_minus(self, pytester: Pytester) -> None:
748 """
749 Comparing approx instances inside lists should not produce an error in the detailed diff.
750 Integration test for issue #2111.
751 """
752 pytester.makepyfile(
753 """
754 import pytest
755 def test_foo():
756 assert [3] == [pytest.approx(4)]
757 """
758 )
759 expected = "4.0e-06"
760 result = pytester.runpytest()
761 result.stdout.fnmatch_lines(
762 [f"*At index 0 diff: 3 != 4 ± {expected}", "=* 1 failed in *="]
763 )
764
765 @pytest.mark.parametrize(
766 "x, name",

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected