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

Method test_float

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

Source from the content-addressed store, hash-verified

718 self.assertEqual(statistics._exact_ratio(f), (n, 37))
719
720 def test_float(self):
721 self.assertEqual(statistics._exact_ratio(0.125), (1, 8))
722 self.assertEqual(statistics._exact_ratio(1.125), (9, 8))
723 data = [random.uniform(-100, 100) for _ in range(100)]
724 for x in data:
725 num, den = statistics._exact_ratio(x)
726 self.assertEqual(x, num/den)
727
728 def test_decimal(self):
729 D = Decimal

Callers

nothing calls this directly

Calls 2

uniformMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected