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

Method test_odd_decimals

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

Source from the content-addressed store, hash-verified

1597 self.assertEqual(self.func(data), F(1, 2))
1598
1599 def test_odd_decimals(self):
1600 # Test median works with an odd number of Decimals.
1601 D = Decimal
1602 data = [D('2.5'), D('3.1'), D('4.2'), D('5.7'), D('5.8')]
1603 assert len(data)%2 == 1
1604 random.shuffle(data)
1605 self.assertEqual(self.func(data), D('4.2'))
1606
1607 def test_even_decimals(self):
1608 # Test median works with an even number of Decimals.

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