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

Method test_repr_string

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

Source from the content-addressed store, hash-verified

275 )
276
277 def test_repr_string(self):
278 assert repr(approx(1.0)) == "1.0 ± 1.0e-06"
279 assert repr(approx([1.0, 2.0])) == "approx([1.0 ± 1.0e-06, 2.0 ± 2.0e-06])"
280 assert repr(approx((1.0, 2.0))) == "approx((1.0 ± 1.0e-06, 2.0 ± 2.0e-06))"
281 assert repr(approx(inf)) == "inf"
282 assert repr(approx(1.0, rel=nan)) == "1.0 ± ???"
283 assert repr(approx(1.0, rel=inf)) == "1.0 ± inf"
284
285 # Dictionaries aren't ordered, so we need to check both orders.
286 assert repr(approx({"a": 1.0, "b": 2.0})) in (
287 "approx({'a': 1.0 ± 1.0e-06, 'b': 2.0 ± 2.0e-06})",
288 "approx({'b': 2.0 ± 2.0e-06, 'a': 1.0 ± 1.0e-06})",
289 )
290
291 def test_repr_complex_numbers(self):
292 assert repr(approx(inf + 1j)) == "(inf+1j)"

Callers

nothing calls this directly

Calls 1

approxFunction · 0.90

Tested by

no test coverage detected