@@ -2454,6 +2454,11 @@ def f(x):
24542454 data = random .choices (range (100 ), k = k )
24552455 q1 , q2 , q3 = quantiles (data , method = 'inclusive' )
24562456 self .assertEqual (q2 , statistics .median (data ))
2457+ # Base case with a single data point: When estimating quantiles from
2458+ # a sample, we want to be able to add one sample point at a time,
2459+ # getting increasingly better estimates.
2460+ self .assertEqual (quantiles ([10 ], n = 4 ), [10.0 , 10.0 , 10.0 ])
2461+ self .assertEqual (quantiles ([10 ], n = 4 , method = 'exclusive' ), [10.0 , 10.0 , 10.0 ])
24572462
24582463 def test_equal_inputs (self ):
24592464 quantiles = statistics .quantiles
@@ -2504,7 +2509,7 @@ def test_error_cases(self):
25042509 with self .assertRaises (ValueError ):
25052510 quantiles ([10 , 20 , 30 ], method = 'X' ) # method is unknown
25062511 with self .assertRaises (StatisticsError ):
2507- quantiles ([10 ], n = 4 ) # not enough data points
2512+ quantiles ([], n = 4 ) # not enough data points
25082513 with self .assertRaises (TypeError ):
25092514 quantiles ([10 , None , 30 ], n = 4 ) # data is non-numeric
25102515
0 commit comments