Skip to content

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

Closed

Description

@svalentin

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

Activity

  1. changed the title [-]incorrect types for decorated functions[/-] [+]incorrect types for functions decorated with `@mock.patch`[/+] on Jul 13, 2023
  2. added a commit that references this issue on Jul 13, 2023
    6a3fd7f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions