1
0
python-random2/python3.9.patch

32 lines
1.4 KiB
Diff
Raw Normal View History

Description: fix tests with python 3.9
Python docs for the function being tested now state:
"Changed in version 3.9: This method now accepts zero for k."
https://docs.python.org/3/library/random.html#random.getrandbits
Author: Juhani Numminen <juhaninumminen0@gmail.com>
Bug-Debian: https://bugs.debian.org/973085
Last-Update: 2020-11-24
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/tests.py
+++ b/src/tests.py
@@ -291,7 +291,8 @@
# Verify argument checking
self.assertRaises(TypeError, self.gen.getrandbits)
self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
- self.assertRaises(ValueError, self.gen.getrandbits, 0)
+ if sys.version_info < (3, 9):
+ self.assertRaises(ValueError, self.gen.getrandbits, 0)
self.assertRaises(ValueError, self.gen.getrandbits, -1)
self.assertRaises(TypeError, self.gen.getrandbits, 10.1)
@@ -448,7 +449,8 @@
self.assertRaises(TypeError, self.gen.getrandbits)
self.assertRaises(TypeError, self.gen.getrandbits, 'a')
self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
- self.assertRaises(ValueError, self.gen.getrandbits, 0)
+ if sys.version_info < (3, 9):
+ self.assertRaises(ValueError, self.gen.getrandbits, 0)
self.assertRaises(ValueError, self.gen.getrandbits, -1)
def test_randbelow_logic(self, _log=log, int=int):