Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect types for functions decorated with @mock.patch #10457

Closed
svalentin opened this issue Jul 13, 2023 · 0 comments · Fixed by #10459
Closed

incorrect types for functions decorated with @mock.patch #10457

svalentin opened this issue Jul 13, 2023 · 0 comments · Fixed by #10459

Comments

@svalentin
Copy link

Looks like we have a typeshed bug:

from unittest.mock import patch

def addition(a: int, b:int) -> int:
    return a+b

@patch('test.addition')
def patch_test(mock):
    print(mock)

if __name__ == "__main__":
    patch_test()

In this simple example mypy says:

test.py:12: error: Missing positional argument "mock" in call to "patch_test"  [call-arg]

Undoing 9e86c60 fixes it

@AlexWaygood AlexWaygood changed the title incorrect types for decorated functions incorrect types for functions decorated with @mock.patch Jul 13, 2023
srittau added a commit to srittau/typeshed that referenced this issue Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant