Skip to content

[stdlib][unittest] Fix mock.call(...) types - #4374

Merged
srittau merged 3 commits into
python:masterfrom
jermenkoo:mock_call
Jul 30, 2020
Merged

srittau merged 3 commits into
python:masterfrom
jermenkoo:mock_call

Conversation

@jermenkoo

Copy link
Copy Markdown
Contributor

#3846 defined _Call and call from unittest.mock, however the exported types are not correct; as:

These 2 make pyre trip, making code such as m = Mock(), m.assert_has_calls([<call_list_here>]) not compatible as call list will be refined as Any as opposed to _Call.

@jermenkoo

Copy link
Copy Markdown
Contributor Author

stubtest failure seems unrelated and Travis CI fails with pytype issue I have no idea how to resolve, as forward refs should be supported just fine

@srittau

srittau commented Jul 30, 2020

Copy link
Copy Markdown
Collaborator

@jermenkoo You can merge current HEAD to fix the stubtest problem. I think pytype doesn't like the quoted forward reference. It's also not necessary in stubs, so just removing the quotes should fix the problem.

@jermenkoo

Copy link
Copy Markdown
Contributor Author

Thanks! TIL stubs work fine even without the quoted forward references :)

@srittau
srittau merged commit c96b1ae into python:master Jul 30, 2020
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 this pull request may close these issues.

2 participants