bpo-32933: Implement dunder iter method on mock_open by TonyFlury · Pull Request #5974 · python/cpython (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation31 Commits13 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
Hello, and thanks for your contribution!
I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).
Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.
Thanks again to your contribution and we look forward to looking at it!
I have signed the CLA - 11:10 GMT 4th March 2018 - not sure how often the bot runs
gst approved these changes Apr 29, 2018
Contributor
gst left a comment
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Member
1st1 left a comment
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks OK overall. The code formatting needs to be fixed in one place, and I also suggest to make code a bit more DRY, which should improve its readability.
while True: |
---|
yield handle.readline.return_value |
for line in _state[0]: |
yield line |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you refactor def _readline_side_effect():
to use this new method for clarity:
def _readline_side_effect():
yield from _iter_side_effect()
while True:
yield type(read_data)()
@@ -1450,6 +1450,14 @@ def test_mock_open_reuse_issue_21750(self): |
---|
f2_data = f2.read() |
self.assertEqual(f1_data, f2_data) |
def test_mock_open_dunder_iter_issue_32933(self): |
mocked_open = mock.mock_open(read_data='Remarkable Bird\nThe Norwegian Blue\nBeautiful Plumage') |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long: trim your code to fit in 79 characters.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again
. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
I have made the requested changes; please review again.
Thanks for making the requested changes!
@1st1: please review the changes made to this pull request.
1st1 approved these changes Apr 30, 2018
Please add a NEWS entry (using the blurb
tool). CI needs to be fixed too before we can merge this.
…ate to official documentation.
I have made the requested changes; please review again.
Thanks for making the requested changes!
@1st1: please review the changes made to this pull request.
Style changes to be consistent with rest of file Added extra readline call to check empty string returned after file is consumed.
I have made the requested changes; please review again
Thanks for making the requested changes!
@berkerpeksag, @1st1: please review the changes made to this pull request.
I have made the requested changes; please review again
Thanks for making the requested changes!
@berkerpeksag, @1st1: please review the changes made to this pull request.
Thanks @TonyFlury for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
(cherry picked from commit 2087023)
Co-authored-by: Tony Flury anthony.flury@btinternet.com
berkerpeksag pushed a commit that referenced this pull request
(cherry picked from commit 2087023)
Co-authored-by: Tony Flury anthony.flury@btinternet.com