MCPcopy Index your code
hub / github.com/python/cpython / test_issue39871

Method test_issue39871

Lib/test/test_math.py:2399–2413  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2397 self.assertEqual(math.ulp(-x), math.ulp(x))
2398
2399 def test_issue39871(self):
2400 # A SystemError should not be raised if the first arg to atan2(),
2401 # copysign(), or remainder() cannot be converted to a float.
2402 class F:
2403 def __float__(self):
2404 self.converted = True
2405 1/0
2406 for func in math.atan2, math.copysign, math.remainder:
2407 y = F()
2408 with self.assertRaises(TypeError):
2409 func("not a number", y)
2410
2411 # There should not have been any attempt to convert the second
2412 # argument to a float.
2413 self.assertFalse(getattr(y, "converted", False))
2414
2415 def test_input_exceptions(self):
2416 self.assertRaises(TypeError, math.exp, "spam")

Callers

nothing calls this directly

Calls 4

assertFalseMethod · 0.80
FClass · 0.70
funcFunction · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected