Skip to content

mocker fixture usage - assistance please #7789

Answered by kevindawson
kevindawson asked this question in Q&A
Discussion options

You must be logged in to vote

@nicoddemus I have pondered over this for some time now:

1, the use of _input to avoid stomping ove the python built-in function(input)

  • I am lead to believe -> it should have been input_ both of which I do not like
  • as mocking is akin to black boxes -> in_put and conversely out_put make more sense

2, Assign mock to a variable, enables capture behaviour

  • but why O why do we have to prefix it with mock_roll_dice as per unittest
  • as pytest-mock let's us define the variable name we could be more descriptive loaded_dice in this case

3, the use of the helper method assert_called_once()

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kevindawson
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