python-random2/python3.9.patch
Dirk Mueller 2b066e73ff - update to 1.0.2:
* Change support to Python 3.10, 3.11, 3.12, and 3.13 only.
- drop python3.9.patch (obsolete)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-random2?expand=0&rev=12
2024-11-10 22:12:45 +00:00

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):