diff options
author | Damien George <damien@micropython.org> | 2021-05-30 16:52:08 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-05-30 17:05:56 +1000 |
commit | c3199f56494429ba44f7e722597945dc91f3589c (patch) | |
tree | 0c63951475cd94dc1eabb02e37e13a9859a47c17 /tests/extmod/urandom_basic.py | |
parent | 34d4dab683c69578b0ddd1725290529dd812b291 (diff) |
extmod/modurandom: Support an argument of bits=0 to getrandbits.
This was changed in CPython 3.9; see https://bugs.python.org/issue40282.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/urandom_basic.py')
-rw-r--r-- | tests/extmod/urandom_basic.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/extmod/urandom_basic.py b/tests/extmod/urandom_basic.py index 180197398..f7f5a6d69 100644 --- a/tests/extmod/urandom_basic.py +++ b/tests/extmod/urandom_basic.py @@ -22,8 +22,11 @@ r = random.getrandbits(16) random.seed(1) print(random.getrandbits(16) == r) -# check that it throws an error for zero bits +# check that zero bits works +print(random.getrandbits(0)) + +# check that it throws an error for negative bits try: - random.getrandbits(0) + random.getrandbits(-1) except ValueError: print("ValueError") |