diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2020-05-01 17:34:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 17:34:19 (GMT) |
commit | 4168f1e46041645cf54bd053981270d8c4c1313b (patch) | |
tree | 2374e163fb3c433e17bc44656336de4213a8e61b /Lib/test/test_random.py | |
parent | 03b7642265e65f198682f22648dbe6cf4fff9835 (diff) | |
download | cpython-4168f1e46041645cf54bd053981270d8c4c1313b.zip cpython-4168f1e46041645cf54bd053981270d8c4c1313b.tar.gz cpython-4168f1e46041645cf54bd053981270d8c4c1313b.tar.bz2 |
Simplify choice()'s interaction with the private _randbelow() method (GH-19831)
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r-- | Lib/test/test_random.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 42c68dd..6d87d21 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -688,10 +688,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase): maxsize+1, maxsize=maxsize ) self.gen._randbelow_without_getrandbits(5640, maxsize=maxsize) - # issue 33203: test that _randbelow raises ValueError on + # issue 33203: test that _randbelow returns zero on # n == 0 also in its getrandbits-independent branch. - with self.assertRaises(ValueError): - self.gen._randbelow_without_getrandbits(0, maxsize=maxsize) + x = self.gen._randbelow_without_getrandbits(0, maxsize=maxsize) + self.assertEqual(x, 0) # This might be going too far to test a single line, but because of our # noble aim of achieving 100% test coverage we need to write a case in |