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

Method test_repr_complex_numbers

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

Source from the content-addressed store, hash-verified

289 )
290
291 def test_repr_complex_numbers(self):
292 assert repr(approx(inf + 1j)) == "(inf+1j)"
293 assert repr(approx(1.0j, rel=inf)) == "1j ± inf"
294
295 # can't compute a sensible tolerance
296 assert repr(approx(nan + 1j)) == "(nan+1j) ± ???"
297
298 assert repr(approx(1.0j)) == "1j ± 1.0e-06 ∠ ±180°"
299
300 # relative tolerance is scaled to |3+4j| = 5
301 assert repr(approx(3 + 4 * 1j)) == "(3+4j) ± 5.0e-06 ∠ ±180°"
302
303 # absolute tolerance is not scaled
304 assert repr(approx(3.3 + 4.4 * 1j, abs=0.02)) == "(3.3+4.4j) ± 2.0e-02 ∠ ±180°"
305
306 @pytest.mark.parametrize(
307 "value, expected_repr_string",

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected