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

Method test_error_cases

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

Source from the content-addressed store, hash-verified

2676 self.assertTrue(sizes <= group_sizes)
2677
2678 def test_error_cases(self):
2679 quantiles = statistics.quantiles
2680 StatisticsError = statistics.StatisticsError
2681 with self.assertRaises(TypeError):
2682 quantiles() # Missing arguments
2683 with self.assertRaises(TypeError):
2684 quantiles([10, 20, 30], 13, n=4) # Too many arguments
2685 with self.assertRaises(TypeError):
2686 quantiles([10, 20, 30], 4) # n is a positional argument
2687 with self.assertRaises(StatisticsError):
2688 quantiles([10, 20, 30], n=0) # n is zero
2689 with self.assertRaises(StatisticsError):
2690 quantiles([10, 20, 30], n=-1) # n is negative
2691 with self.assertRaises(TypeError):
2692 quantiles([10, 20, 30], n=1.5) # n is not an integer
2693 with self.assertRaises(ValueError):
2694 quantiles([10, 20, 30], method='X') # method is unknown
2695 with self.assertRaises(StatisticsError):
2696 quantiles([], n=4) # not enough data points
2697 with self.assertRaises(TypeError):
2698 quantiles([10, None, 30], n=4) # data is non-numeric
2699
2700
2701class TestBivariateStatistics(unittest.TestCase):

Callers

nothing calls this directly

Calls 2

quantilesFunction · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected