Skip to content

Instantly share code, notes, and snippets.

@johnmanjiro13
Created October 26, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmanjiro13/b6b8b6e09c24c1a313e6a18883759494 to your computer and use it in GitHub Desktop.
Save johnmanjiro13/b6b8b6e09c24c1a313e6a18883759494 to your computer and use it in GitHub Desktop.
mock_func for test decorator
from unittest.mock import MagicMock
mock_func = MagicMock()
mock_func.return_value = "mock return !" # 戻り値の設定
mock_func.side_effect = Exception() # 例外の設定
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment