Repository navigation
Add missing randbytes method on random - #3209
Merged
Merged
Conversation
Contributor
|
Heads up: Currently our GitHub Actions workflow uses CPython 3.8 as a reference. You might want to add something to |
Contributor
Author
Member
fanninpm
reviewed
Oct 5, 2021
Comment on lines
+26
to
+33
| # random.randbytes | ||
| random.seed(1234) | ||
| zero_size_buf = random.randbytes(0) | ||
| assert type(zero_size_buf) is bytes | ||
| assert len(zero_size_buf) == 0 | ||
| non_zero_buf = random.randbytes(4) | ||
| assert type(non_zero_buf) is bytes | ||
| assert list(non_zero_buf) == list(b'\xb9\x7fi\xf7') |
Contributor
There was a problem hiding this comment.
Try experimenting with testutils.skip_if_unsupported (defined here). Here's an example of it in action.
Contributor
|
Actually, with #2831 having been merged, the points I have raised up to now are no longer applicable. @youknowone can we rerun the CI for this PR? |
Contributor
Author
|
Thanks, @fanninpm for the hints! Sorry for the late reply. If you need any other modifications, please let me know. I'll be happy to apply your suggestions. |
Member
|
could you rebase it to run tests with python3.9? |
Contributor
Author
|
@youknowone Done 👍 |
youknowone
approved these changes
Oct 6, 2021
Member
|
thank you for contributing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds missing
randbytesmethod onrandom(see official documentation for the method: https://docs.python.org/3/library/random.html#random.randbytes).