mockito-python icon indicating copy to clipboard operation
mockito-python copied to clipboard

`verifyNoUnwantedInteractions` is named poorly

Open kaste opened this issue 11 months ago • 0 comments

See https://stackoverflow.com/questions/53742022/how-to-properly-use-verifynounwantedinteractions-in-python-mockito/54346862

verifyNoUnwantedInteractions only works when the user used expect. Clearly better candidates are verifyExpectations or the more verbose verifyExpectationsAreMet. That at least indicates that a when might not be enough.

~~(However, setting up a when (patch) indicates that you also use it, otherwise why would you set it up? For which we have verifyStubbedInvocationsAreUsed explicitly. Maybe rename that to the shorter verifyStubsAreUsed and also check if the mock is used at all, i.e. if len(theMock.invocations) > 0 which would be the inverse of verifyZeroInteractions?)~~ Scratch the latter, stubs or mocks can used just by passing them around.

kaste avatar Jan 25 '25 10:01 kaste