Mox mocking library allows you to be either specific or agnostic about the class you are mocking.
mock = mox.CreateMock(Foo)
ormock = mox.CreateMockAnything()
Mox documentation suggests to use the first way (basically check the type of the mock) wherever it is possible. Python as a dynamic language is type agnostic. The two approaches look inconsistent to me.
So, which approach to mocking is more Pythonic?
They are not the same. From the documentation:
In contrast, when creating a mock using
CreateMock(Foo)
, you get an exception when an unknown method is called.