mocksafe.mock
- mocksafe.mock(spec: type[T], name: str | None = None) T
Creates a mock of the given
spec.- Parameters:
- Returns:
a mock object but typed with the generic type
T- Return type:
T
- Example:
>>> from random import Random >>> mock_random: Random = mock(Random) >>> mock_random SafeMock(<class 'random.Random'>)
To stub a mocked method see:
To assert calls made to a mocked method see:
To retrieve calls that were made to a mocked method see: