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

Method test_decimal

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

Source from the content-addressed store, hash-verified

726 self.assertEqual(x, num/den)
727
728 def test_decimal(self):
729 D = Decimal
730 _exact_ratio = statistics._exact_ratio
731 self.assertEqual(_exact_ratio(D("0.125")), (1, 8))
732 self.assertEqual(_exact_ratio(D("12.345")), (2469, 200))
733 self.assertEqual(_exact_ratio(D("-1.98")), (-99, 50))
734
735 def test_inf(self):
736 INF = float("INF")

Callers

nothing calls this directly

Calls 3

_exact_ratioFunction · 0.85
DClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected