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

Method test_special_values

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

Source from the content-addressed store, hash-verified

1906 fmean([10, 20, 60], 70) # too many arguments
1907
1908 def test_special_values(self):
1909 # Rules for special values are inherited from math.fsum()
1910 fmean = statistics.fmean
1911 NaN = float('Nan')
1912 Inf = float('Inf')
1913 self.assertTrue(math.isnan(fmean([10, NaN])), 'nan')
1914 self.assertTrue(math.isnan(fmean([NaN, Inf])), 'nan and infinity')
1915 self.assertTrue(math.isinf(fmean([10, Inf])), 'infinity')
1916 with self.assertRaises(ValueError):
1917 fmean([Inf, -Inf])
1918
1919 def test_weights(self):
1920 fmean = statistics.fmean

Callers

nothing calls this directly

Calls 3

fmeanFunction · 0.85
assertTrueMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected