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

Method test_decimal

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

Source from the content-addressed store, hash-verified

976 self.check_exact_equal(x, MyFloat(1.125))
977
978 def test_decimal(self):
979 # Test conversions to Decimal.
980 x = statistics._convert(Fraction(1, 40), Decimal)
981 self.check_exact_equal(x, Decimal("0.025"))
982 class MyDecimal(Decimal):
983 def __truediv__(self, other):
984 return self.__class__(super().__truediv__(other))
985 x = statistics._convert(Fraction(-15, 16), MyDecimal)
986 self.check_exact_equal(x, MyDecimal("-0.9375"))
987
988 def test_inf(self):
989 for INF in (float('inf'), Decimal('inf')):

Callers

nothing calls this directly

Calls 4

check_exact_equalMethod · 0.95
FractionClass · 0.90
DecimalClass · 0.90
MyDecimalClass · 0.70

Tested by

no test coverage detected