mocksafe.when

mocksafe.when(mock_method: Callable[[...], T]) WhenStubber[T]

Stub a mocked method.

Parameters:

mock_method – a method on a mock object that returns generic type T

Return type:

WhenStubber[T]

Example:
>>> when(mock_random.random)
<mocksafe.apis.bdd.when_then.WhenStubber object at 0x...>
Example:
>>> when(mock_random.random).any_call().then_return(0.31)