summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2021-01-02 18:24:51 (GMT)
committerGitHub <noreply@github.com>2021-01-02 18:24:51 (GMT)
commit768fa145cfec2a0599802b74fc31d2bc2812ed96 (patch)
tree82a05bdab29e98b329de8a3b742f870d63a52ca7 /Lib/test/test_random.py
parent607501abb488fb37e33cf9d35260ab7baefa192f (diff)
downloadcpython-768fa145cfec2a0599802b74fc31d2bc2812ed96.zip
cpython-768fa145cfec2a0599802b74fc31d2bc2812ed96.tar.gz
cpython-768fa145cfec2a0599802b74fc31d2bc2812ed96.tar.bz2
bpo-42772: Step argument ignored when stop is None. (GH-24018)
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 436f3c9..41a26e3 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -562,6 +562,14 @@ class SystemRandom_TestBasicOps(TestBasicOps, unittest.TestCase):
with self.assertRaises(ValueError):
randrange(10, 20, 1.5)
+ def test_randrange_step(self):
+ # bpo-42772: When stop is None, the step argument was being ignored.
+ randrange = self.gen.randrange
+ with self.assertRaises(TypeError):
+ randrange(1000, step=100)
+ with self.assertRaises(TypeError):
+ randrange(1000, None, step=100)
+
def test_randbelow_logic(self, _log=log, int=int):
# check bitcount transition points: 2**i and 2**(i+1)-1
# show that: k = int(1.001 + _log(n, 2))