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

Method test_float_nan

Lib/test/test_statistics.py:749–757  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

747 self.assertTrue(math.isinf(ratio[0]))
748
749 def test_float_nan(self):
750 NAN = float("NAN")
751 class MyFloat(float):
752 pass
753 for nan in (NAN, MyFloat(NAN)):
754 ratio = statistics._exact_ratio(nan)
755 self.assertTrue(math.isnan(ratio[0]))
756 self.assertIs(ratio[1], None)
757 self.assertEqual(type(ratio[0]), type(nan))
758
759 def test_decimal_nan(self):
760 NAN = Decimal("NAN")

Callers

nothing calls this directly

Calls 4

assertTrueMethod · 0.80
MyFloatClass · 0.70
assertIsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected