Skip to content

Commit 733ac96

Browse files
gh-154945: add regression test for NormalDist.quantiles(0)
Adds test_quantiles_invalid_n to verify that NormalDist.quantiles(n) raises StatisticsError when n < 1, mirroring the module-level quantiles() validation. Currently fails (test is red) — quantiles(0) silently returns [] instead of raising.
1 parent ac8ba0c commit 733ac96

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_statistics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,6 +3105,13 @@ def test_quantiles(self):
31053105
self.assertTrue(all(math.isclose(e, a, abs_tol=0.0001)
31063106
for e, a in zip(expected, actual)))
31073107

3108+
def test_quantiles_invalid_n(self):
3109+
# quantiles(n) should reject n < 1
3110+
Z = self.module.NormalDist()
3111+
with self.assertRaises(self.module.StatisticsError) as cm:
3112+
Z.quantiles(0)
3113+
self.assertEqual(str(cm.exception), 'n must be at least 1')
3114+
31083115
def test_overlap(self):
31093116
NormalDist = self.module.NormalDist
31103117

0 commit comments

Comments
 (0)