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

Method test_even_decimals

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

Source from the content-addressed store, hash-verified

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.
1609 D = Decimal
1610 data = [D('1.2'), D('2.5'), D('3.1'), D('4.2'), D('5.7'), D('5.8')]
1611 assert len(data)%2 == 0
1612 random.shuffle(data)
1613 self.assertEqual(self.func(data), D('3.65'))
1614
1615
1616class TestMedianDataType(NumericTestCase, UnivariateTypeMixin):

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