I usually write a xdep alternative implementation. I don't call it a mock, because is an implementation of the same service, but local. And I use it even in the final application (for first iteration, for demo purpose). You can build it using TDD, and then, inject it to the exists() test. It has no additional method like "expected" nor other mockist methods.
It makes sense to me, but if we forget Python's module name of unittest.mock uses word 'mock',
then the only difference at low level of how xdep double is implemented:
- you would write by hand an alternative implementation of xdep
- I use Mock class to automate things
# mock will generate implementation for me
self.xdep = mock.Mock()
# I ask the object of Mock class to 'implement get_item for me so it returns 1'
self.xdep.get_item.return_value = 1 ?
but net result (and effect) is the same, I believe.
The details how the 'magic' happens, let someone write by hand or let something generate it, are IMO not important for my question
which Roy has nicely captured in?
"I would use a STUB for a get_something if not faking it meant an integration test"
How the get_something is faked, that is a different kind of issue.