bpo-23078: Add support for staticmethod and classmethod to mock created with autospec by tirkarthi ยท Pull Request #11613 ยท python/cpython
@mariocj89 @cjw296 Friendly ping. I have converted the patch from the tracker to PR attributing to original author. It was a frequently requested mock feature and I would be happy to act on review comments for this one.
Thanks.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!, small nitpicks if you want to pick them.
| #Issue23078 | ||
| def test_create_autospec_staticmethod(self): | ||
| class TestClass: | ||
| method = staticmethod(lambda: None) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to read with the common syntax decorating the method.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed to decorators ๐
| @@ -0,0 +1,2 @@ | |||
| Add support for staticmethod and classmethod with autospec. Based on patch | |||
| by Felipe. | |||
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to include Felipe's surname. And you can also get credit for this :).
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! ๐
Thanks @tirkarthi for the PR, and @berkerpeksag for merging it ๐ฎ๐.. I'm working now to backport this PR to: 3.7.
๐๐โ๐ค
Sorry, @tirkarthi and @berkerpeksag, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 9b21856b0fcda949de239edc7aa6cf3f2f4f77a3 3.7
berkerpeksag pushed a commit to berkerpeksag/cpython that referenced this pull request
Apr 22, 2019โฆec() (pythonGH-11613) Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com> (cherry picked from commit 9b21856)
berkerpeksag added a commit that referenced this pull request
Apr 22, 2019This 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