forked from pool/python-random2
Dirk Mueller
7cde60125e
- Add patch from Debian to fix build with python 3.9: * python3.9.patch OBS-URL: https://build.opensuse.org/request/show/886211 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-random2?expand=0&rev=7
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
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):
|