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

Method test_even_decimals

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

Source from the content-addressed store, hash-verified

1762 self.assertEqual(self.func(data), 6.75)
1763
1764 def test_even_decimals(self):
1765 # Test median_grouped works with an even number of Decimals.
1766 D = Decimal
1767 data = [D('5.5'), D('5.5'), D('6.5'), D('6.5'), D('7.5'), D('8.5')]
1768 assert len(data)%2 == 0
1769 random.shuffle(data)
1770 self.assertEqual(self.func(data), 6.5)
1771 #---
1772 data = [D('5.5'), D('5.5'), D('6.5'), D('7.5'), D('7.5'), D('8.5')]
1773 assert len(data)%2 == 0
1774 random.shuffle(data)
1775 self.assertEqual(self.func(data), 7.0)
1776
1777 def test_interval(self):
1778 # Test median_grouped with interval argument.

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