Closed
Description
#135326 exposed the fact that there was no tests for objects implementing __index__
in test_random
, even if some code in the random
module explicitly support them.
When trying to add more tests, I discovered that
- Some code is literally duplicated for Random and SystemRandom tests. It is easy to make error by modifying only only one of the copy.
- As consequence of this, some tests were only added for SystemRandom, even if they are not specific for SystemRandom.
There was also no tests for randint()
.
So the following PR reorganizes test_random
: removes duplicated code, makes sure that implementation agnostic tests are run for both classes, and add few new tests.