MCPcopy Index your code
hub / github.com/pytest-dev/pytest / test_yield_comparisons

Method test_yield_comparisons

testing/python/approx.py:1362–1371  ·  view source on GitHub ↗

Test that _yield_comparisons yields (actual, expected) pairs.

(self)

Source from the content-addressed store, hash-verified

1360 assert "string" != approx(datetime(2024, 1, 1), abs=timedelta(seconds=1))
1361
1362 def test_yield_comparisons(self):
1363 """Test that _yield_comparisons yields (actual, expected) pairs."""
1364 from datetime import datetime
1365 from datetime import timedelta
1366
1367 dt = datetime(2024, 1, 1, 12, 0, 0)
1368 a = approx(dt, abs=timedelta(seconds=1))
1369 actual = datetime(2024, 1, 1, 12, 0, 0, 500000)
1370 pairs = list(a._yield_comparisons(actual))
1371 assert pairs == [(actual, dt)]
1372
1373 def test_repr_compare_with_incompatible_type(self):
1374 """_repr_compare handles TypeError when actual is not a datetime."""

Callers

nothing calls this directly

Calls 2

approxFunction · 0.90
_yield_comparisonsMethod · 0.45

Tested by

no test coverage detected