Provide custom logic for mocking classes that are callable.
(self, *params, **named_params)
| 488 | return self._CreateMockMethod('__getitem__')(key) |
| 489 | |
| 490 | def __call__(self, *params, **named_params): |
| 491 | """Provide custom logic for mocking classes that are callable.""" |
| 492 | |
| 493 | # Verify the class we are mocking is callable |
| 494 | callable = self._class_to_mock.__dict__.get('__call__', None) |
| 495 | if callable is None: |
| 496 | raise TypeError('Not callable') |
| 497 | |
| 498 | # Because the call is happening directly on this object instead of a method, |
| 499 | # the call on the mock method is made right here |
| 500 | mock_method = self._CreateMockMethod('__call__') |
| 501 | return mock_method(*params, **named_params) |
| 502 | |
| 503 | @property |
| 504 | def __class__(self): |
nothing calls this directly
no test coverage detected