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

Method test_decimals_exact

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

Source from the content-addressed store, hash-verified

1492 self.assertEqual(self.func([x]), x)
1493
1494 def test_decimals_exact(self):
1495 # Test harmonic mean with some carefully chosen Decimals.
1496 D = Decimal
1497 self.assertEqual(self.func([D(15), D(30), D(60), D(60)]), D(30))
1498 data = [D("0.05"), D("0.10"), D("0.20"), D("0.20")]
1499 random.shuffle(data)
1500 self.assertEqual(self.func(data), D("0.10"))
1501 data = [D("1.68"), D("0.32"), D("5.94"), D("2.75")]
1502 random.shuffle(data)
1503 self.assertEqual(self.func(data), D(66528)/70723)
1504
1505 def test_fractions(self):
1506 # Test harmonic mean with Fractions.

Callers

nothing calls this directly

Calls 4

shuffleMethod · 0.80
DClass · 0.70
assertEqualMethod · 0.45
funcMethod · 0.45

Tested by

no test coverage detected