summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-11-21 22:34:33 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-11-21 22:34:33 (GMT)
commitbf87126a636bddf2d9a8f432215fe2efb98ba8fe (patch)
tree6d371582293e1813a6a1da1e2eabef361186cf0f /Lib/test/test_random.py
parent546ce65968921f52f1c79a7218e57dc237dbe436 (diff)
downloadcpython-bf87126a636bddf2d9a8f432215fe2efb98ba8fe.zip
cpython-bf87126a636bddf2d9a8f432215fe2efb98ba8fe.tar.gz
cpython-bf87126a636bddf2d9a8f432215fe2efb98ba8fe.tar.bz2
Issue 28475: Improve error message for random.sample() with k < 0. (Contributed by Francisco Couzo).
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index fd0d2e3..84a1e83 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -110,6 +110,7 @@ class TestBasicOps:
self.assertEqual(self.gen.sample([], 0), []) # test edge case N==k==0
# Exception raised if size of sample exceeds that of population
self.assertRaises(ValueError, self.gen.sample, population, N+1)
+ self.assertRaises(ValueError, self.gen.sample, [], -1)
def test_sample_distribution(self):
# For the entire allowable range of 0 <= k <= N, validate that