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.
See https://stackoverflow.com/questions/53742022/how-to-properly-use-verifynounwantedinteractions-in-python-mockito/54346862
verifyNoUnwantedInteractionsonly works when the user usedexpect. Clearly better candidates areverifyExpectationsor the more verboseverifyExpectationsAreMet. That at least indicates that awhenmight not be enough.(However, setting up aScratch the latter, stubs or mocks can used just by passing them around.when(patch) indicates that you also use it, otherwise why would you set it up? For which we haveverifyStubbedInvocationsAreUsedexplicitly. Maybe rename that to the shorterverifyStubsAreUsedand also check if the mock is used at all, i.e. iflen(theMock.invocations) > 0which would be the inverse ofverifyZeroInteractions?)