MCPcopy
hub / github.com/pytest-dev/pytest / test_repr_complex_numbers

Method test_repr_complex_numbers

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

Source from the content-addressed store, hash-verified

355 assert repr(approx(1500, abs=555)) == "1500 ± 555"
356
357 def test_repr_complex_numbers(self):
358 assert repr(approx(inf + 1j)) == "(inf+1j)"
359 assert repr(approx(1.0j, rel=inf)) == "1j ± inf"
360
361 # can't compute a sensible tolerance
362 assert repr(approx(nan + 1j)) == "(nan+1j) ± ???"
363
364 assert repr(approx(1.0j)) == "1j ± 1.0e-06 ∠ ±180°"
365
366 # relative tolerance is scaled to |3+4j| = 5
367 assert repr(approx(3 + 4 * 1j)) == "(3+4j) ± 5.0e-06 ∠ ±180°"
368
369 # absolute tolerance is not scaled
370 assert repr(approx(3.3 + 4.4 * 1j, abs=0.02)) == "(3.3+4.4j) ± 0.02 ∠ ±180°"
371
372 @pytest.mark.parametrize(
373 "value, expected_repr_string",

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected