[issue30308] Add code coverage for argument in random.shuffle

2017-05-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thank you for the patch. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ _

[issue30308] Add code coverage for argument in random.shuffle

2017-05-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset f111fd2e65ef7aefd4ebeadbb48e84d609bf3733 by Raymond Hettinger (csabella) in branch 'master': bpo-30308: Code coverage for argument in random.shuffle (#1504) https://github.com/python/cpython/commit/f111fd2e65ef7aefd4ebeadbb48e84d609bf3733 ---

[issue30308] Add code coverage for argument in random.shuffle

2017-05-09 Thread Cheryl Sabella
Cheryl Sabella added the comment: I've also changed the test to use Mock for the random function. I'm new to mock, so I'm not sure if I did it right. Using a return_value seemed to be the best way to go. I didn't know if it was necessary to test if an incorrect function was sent in. --

[issue30308] Add code coverage for argument in random.shuffle

2017-05-09 Thread Cheryl Sabella
Cheryl Sabella added the comment: OK, I've removed the test for the negative values returned by random. In core-mentorship, David Murray had suggested adding a comment to document it as unexpected behavior. I had asked there because I wasn't quite sure what to do about it. Should I also lea

[issue30308] Add code coverage for argument in random.shuffle

2017-05-09 Thread Mark Dickinson
Mark Dickinson added the comment: I'm also a bit uncomfortable with adding tests for other specific exceptions when a misbehaving `random` is passed: again, the details of whether an exception is raised or not for "self.assertRaises(IndexError, shuffle, seq, random=lambda: -1.1)", and which pr

[issue30308] Add code coverage for argument in random.shuffle

2017-05-09 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue30308] Add code coverage for argument in random.shuffle

2017-05-09 Thread Mark Dickinson
Mark Dickinson added the comment: I see you've added a test for the behaviour of: shuffle(seq, random=lambda: -1.0) I'd suggest leaving that test out: that this works right now is really just an accident of the (CPython) implementation, and it may well not work on other Python implementat

[issue30308] Add code coverage for argument in random.shuffle

2017-05-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: * Why not use unittest.mock to test the *random* argument for shuffle? * Try to avoid direct calls to _randbelow(). That method is a non-public implementation detail subject to change. * Also please don't make test_random.py depend on secrets which itself

[issue30308] Add code coverage for argument in random.shuffle

2017-05-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue30308] Add code coverage for argument in random.shuffle

2017-05-08 Thread Cheryl Sabella
Cheryl Sabella added the comment: Add Mark Dickinson and Raymond Hettinger to nosy list per Brett's suggestion on core-mentorship. -- nosy: +mark.dickinson, rhettinger ___ Python tracker __

[issue30308] Add code coverage for argument in random.shuffle

2017-05-08 Thread Cheryl Sabella
Changes by Cheryl Sabella : -- pull_requests: +1604 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue30308] Add code coverage for argument in random.shuffle

2017-05-08 Thread Cheryl Sabella
New submission from Cheryl Sabella: Added test cases for `random` argument in random.shuffle for code coverage. Two interesting results (documented within test cases): 1. In the docs, `random` is defined as a function returning a float in the range [0, 1), but negative floats could be returned