MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_error_cases

Method test_error_cases

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

quantilesFunction · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected