Skip to content

mysql_info: Explanation unit-test #122

Answered by Jorge-Rodriguez
rndmh3ro asked this question in Q&A
Discussion options

You must be logged in to vote

Let's take this one step at a time:
MagicMock() is part of the standard unittest.mock library and it's its implementation of a mock object, the purpose of which is to replace an actual object with a simulation whose behavior we can control.

When a method is called on a MagicMock instance, the default behavior is to return another MagickMock object. Generally you can modify this behaviour by setting the return_value attribute. When the desired effects of a call on a particular method of the MagicMock class are more complex than simply returning a value, e.g. the value needs to change in subsequent calls, an exception needs to be raised, or any other complex behaviour, this can be accomplis…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jorge-Rodriguez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants