Title: Need a way to specify types for mock objects (e.g. mock.Mock()) · Issue #1188 · python/mypy · GitHub
Open Graph Title: Need a way to specify types for mock objects (e.g. mock.Mock()) · Issue #1188 · python/mypy
X Title: Need a way to specify types for mock objects (e.g. mock.Mock()) · Issue #1188 · python/mypy
Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Open Graph Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
X Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Opengraph URL: https://github.com/python/mypy
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Need a way to specify types for mock objects (e.g. mock.Mock())","articleBody":"Example test case code here:\n\n```\nif True:\n from pycurl import Curl, version_info\nelse:\n from mock import Mock\n Curl = Mock()\n version_info = Mock()\n```\n\nPosting this in mypy, since I don't think it's possible to specify a typeshed type for mock.Mock that won't throw an error; e.g. if stubs say `mock.Mock` is an `Any`, you get `/home/tabbott/foo.py:7: error: Invalid assignment target`\n\nReporting as separate from #1152 since this might be worth solving even if that is not, since most every use of mock.Mock() will have this problem.\n","author":{"url":"https://github.com/timabbott","@type":"Person","name":"timabbott"},"datePublished":"2016-01-28T23:24:41Z","url":"https://github.com/python/mypy/issues/1188"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:9ddfa54b-e0a1-0c71-b6c8-0c4b850e8d3f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E40A:29A20E:238A53C:30568AA:6B002CCF |
| html-safe-nonce | 0a04bc69c9408c9575097fc14743bb9076b0e37f6aff5839a28afcb2d065f618 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDBBOjI5QTIwRToyMzhBNTNDOjMwNTY4QUE6NkIwMDJDQ0YiLCJ2aXNpdG9yX2lkIjoiMzc0MzU1NDA3MjE4NDIwOTQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c08e0e6e35de76ad604487eea15da6cf37290c6c91010d130dfff2bf12366b1d |
| hovercard-subject-tag | repository:7053637 |
| 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/python/mypy/issues/1188 |
| twitter:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| og:image:alt | Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-cache |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width