Title: incorrect types for functions decorated with `@mock.patch` · Issue #10457 · python/typeshed · GitHub
Open Graph Title: incorrect types for functions decorated with `@mock.patch` · Issue #10457 · python/typeshed
X Title: incorrect types for functions decorated with `@mock.patch` · Issue #10457 · python/typeshed
Description: 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 my...
Open Graph Description: 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__"...
X Description: 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__ ==...
Opengraph URL: https://github.com/python/typeshed/issues/10457
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"incorrect types for functions decorated with `@mock.patch`","articleBody":"Looks like we have a typeshed bug:\r\n```\r\nfrom unittest.mock import patch\r\n\r\ndef addition(a: int, b:int) -\u003e int:\r\n return a+b\r\n\r\n@patch('test.addition')\r\ndef patch_test(mock):\r\n print(mock)\r\n\r\nif __name__ == \"__main__\":\r\n patch_test()\r\n```\r\n\r\nIn this simple example mypy says:\r\n```\r\ntest.py:12: error: Missing positional argument \"mock\" in call to \"patch_test\" [call-arg]\r\n```\r\n\r\nUndoing https://github.com/python/typeshed/commit/9e86c6026a00a7bcc6c77ec8f7925a99930ee983 fixes it","author":{"url":"https://github.com/svalentin","@type":"Person","name":"svalentin"},"datePublished":"2023-07-13T18:27:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/10457/typeshed/issues/10457"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:01ce84b1-aca3-9751-7f1c-62decfb00296 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A614:FFA25:CB523B:117C13A:6A612A38 |
| html-safe-nonce | 39a0d77ed362814f4e2f94e814945bb89b14491a2e891442181008bc5deb2fa9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjE0OkZGQTI1OkNCNTIzQjoxMTdDMTNBOjZBNjEyQTM4IiwidmlzaXRvcl9pZCI6Ijc2Mzg4ODcyMDc5MDM3NjcwOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7ca316048eab28cd366e2228c295c193f5a16411f117c8f60c8d89cd7a2a7420 |
| hovercard-subject-tag | issue:1803552685 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/10457/issue_layout |
| twitter:image | https://opengraph.githubassets.com/82b6969d5e6ca4b5a36c62dc451a32ca7b1fbd13df3e810fc22f7df3a3802a77/python/typeshed/issues/10457 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/82b6969d5e6ca4b5a36c62dc451a32ca7b1fbd13df3e810fc22f7df3a3802a77/python/typeshed/issues/10457 |
| og:image:alt | 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__"... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | svalentin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6896275b704df9b9258326d49c8695aecd98d736cd9eeda7bcbb1790ac97d3ad |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af89f6cd55841b57fa09b6b0ed9e3f8f2e94b05d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width