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

Method test_issue39871

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

Source from the content-addressed store, hash-verified

2490 self.assertEqual(math.ulp(-x), math.ulp(x))
2491
2492 def test_issue39871(self):
2493 # A SystemError should not be raised if the first arg to atan2(),
2494 # copysign(), or remainder() cannot be converted to a float.
2495 class F:
2496 def __float__(self):
2497 self.converted = True
2498 1/0
2499 for func in math.atan2, math.copysign, math.remainder:
2500 y = F()
2501 with self.assertRaises(TypeError):
2502 func("not a number", y)
2503
2504 # There should not have been any attempt to convert the second
2505 # argument to a float.
2506 self.assertFalse(getattr(y, "converted", False))
2507
2508 def test_input_exceptions(self):
2509 self.assertRaises(TypeError, math.exp, "spam")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected