[issue40046] Increase test coverage of the random module

Serhiy Storchaka report at bugs.python.org
Mon Mar 30 14:53:10 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Yes, of course. The PR adds new tests for different types of arguments which currently are accepted (so it would be a regression if they will no accepted in new releases or in alternate implementations) and for types which currently are not accepted for reasons, so unexpected accepting may signal about using inefficient or incorrect algorithm.

For example, choice() works not only with lists, but with other sequences, so the implementation which works only with lists (for example the C implementation which uses the concrete C API) will fail with new tests. If we fix this hypothetical implementation by converting the argument to list (which would be inefficient for large collections), other new tests (which check that sets and iterators are not accepted) will fail.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40046>
_______________________________________


More information about the Python-bugs-list mailing list