MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_abs

Method test_abs

Lib/test/test_complex.py:784–789  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

782 self.assertNotEqual(hash(2000005 - 1j), -1)
783
784 def test_abs(self):
785 nums = [complex(x/3., y/7.) for x in range(-9,9) for y in range(-9,9)]
786 for num in nums:
787 self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num))
788
789 self.assertRaises(OverflowError, abs, complex(DBL_MAX, DBL_MAX))
790
791 def test_repr_str(self):
792 def test(v, expected, test_fn=self.assertEqual):

Callers

nothing calls this directly

Calls 3

assertAlmostEqualMethod · 0.95
absFunction · 0.50
assertRaisesMethod · 0.45

Tested by

no test coverage detected