Created
December 17, 2019 14:22
-
-
Save dotandimet/c3ddb1e40cf34f378182565869d0ff82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest.mock import Mock, patch | |
import mypackage | |
import other | |
def test(): | |
thing = mypackage.get_my_class() | |
thing.method = Mock() | |
with patch('other.get_my_class', | |
return_value=thing) as mock_method: | |
other.other_func() | |
thing.method.assert_called_once_with(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment