Last active
February 20, 2021 19:24
-
-
Save previtus/fa4bada86ab654d84f2cb255725321aa to your computer and use it in GitHub Desktop.
Mock Settings
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
# v1 | |
import mock | |
settings = mock.Mock() | |
settings.foo = 42 | |
# v2 | |
# works even when checking for non-existing entries... | |
from unittest.mock import Mock, MagicMock | |
args = MagicMock(name='method') | |
args.foo = 3 | |
args.foo2 = 3 | |
server = Server(args) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment