This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Increase test coverage of the random module
Type: enhancement Stage: resolved
Components: Documentation, Tests Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, mark.dickinson, rhettinger, serhiy.storchaka, tim.peters, willingc
Priority: normal Keywords: patch

Created on 2020-03-23 09:01 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19114 closed serhiy.storchaka, 2020-03-23 09:03
Messages (6)
msg364840 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-23 09:01
The propose test adds several tests for random module. Mainly tests for integer, sequence and iterable arguments.

It also documents that randrange() accepts non-integers.
msg364858 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-03-23 15:42
I'm against this doc change.  While factually true, it is irrelevant and distracting to most users.  We do not need to test and document every implementation detail, nor should we.
msg364859 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-23 15:51
What is wrong with adding more tests?
msg365336 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2020-03-30 18:01
Hi Raymond and Serhiy,

Serhiy, Was there a specific use case or regression that you felt the tests would be helpful?
msg365340 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-30 18:53
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.
msg365348 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2020-03-30 20:39
Thanks Serhiy for the explanation.

I agree with Raymond about the doc change.

Raymond, These tests, after reading Serihy's response, make sense to me. Let's revisit and reconsider the PR on the tests without the doc change.

Thanks!
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84227
2020-03-30 20:39:49willingcsetmessages: + msg365348
2020-03-30 18:53:09serhiy.storchakasetmessages: + msg365340
2020-03-30 18:01:45willingcsetnosy: + willingc
messages: + msg365336
2020-03-23 15:51:20serhiy.storchakasetmessages: + msg364859
2020-03-23 15:42:53rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg364858

stage: patch review -> resolved
2020-03-23 09:03:00serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18475
2020-03-23 09:01:11serhiy.storchakacreate