MCPcopy Create free account
hub / github.com/apple/coremltools / __call__

Method __call__

deps/protobuf/python/mox.py:490–501  ·  view source on GitHub ↗

Provide custom logic for mocking classes that are callable.

(self, *params, **named_params)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 3

TypeErrorClass · 0.85
_CreateMockMethodMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected