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

Method test_mixed_int_and_float

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

Source from the content-addressed store, hash-verified

2335 self.assertTrue(math.isnan(geometric_mean([0, Inf]))) # Because 0.0 * Inf -> NaN
2336
2337 def test_mixed_int_and_float(self):
2338 # Regression test for b.p.o. issue #28327
2339 geometric_mean = statistics.geometric_mean
2340 expected_mean = 3.80675409583932
2341 values = [
2342 [2, 3, 5, 7],
2343 [2, 3, 5, 7.0],
2344 [2, 3, 5.0, 7.0],
2345 [2, 3.0, 5.0, 7.0],
2346 [2.0, 3.0, 5.0, 7.0],
2347 ]
2348 for v in values:
2349 with self.subTest(v=v):
2350 actual_mean = geometric_mean(v)
2351 self.assertAlmostEqual(actual_mean, expected_mean, places=5)
2352
2353
2354class TestKDE(unittest.TestCase):

Callers

nothing calls this directly

Calls 3

geometric_meanFunction · 0.85
subTestMethod · 0.45
assertAlmostEqualMethod · 0.45

Tested by

no test coverage detected