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

Method test_error_cases

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

Source from the content-addressed store, hash-verified

1890 self.assertEqual(actual_mean, expected_mean, kind)
1891
1892 def test_error_cases(self):
1893 fmean = statistics.fmean
1894 StatisticsError = statistics.StatisticsError
1895 with self.assertRaises(StatisticsError):
1896 fmean([]) # empty input
1897 with self.assertRaises(StatisticsError):
1898 fmean(iter([])) # empty iterator
1899 with self.assertRaises(TypeError):
1900 fmean(None) # non-iterable input
1901 with self.assertRaises(TypeError):
1902 fmean([10, None, 20]) # non-numeric input
1903 with self.assertRaises(TypeError):
1904 fmean() # missing data argument
1905 with self.assertRaises(TypeError):
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()

Callers

nothing calls this directly

Calls 2

fmeanFunction · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected