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

Method __call__

deps/protobuf/python/mox.py:545–573  ·  view source on GitHub ↗

Log parameters and return the specified return value. If the Mock(Anything/Object) associated with this call is in record mode, this MockMethod will be pushed onto the expected call queue. If the mock is in replay mode, this will pop a MockMethod off the top of the queue and verify

(self, *params, **named_params)

Source from the content-addressed store, hash-verified

543 self._side_effects = None
544
545 def __call__(self, *params, **named_params):
546 """Log parameters and return the specified return value.
547
548 If the Mock(Anything/Object) associated with this call is in record mode,
549 this MockMethod will be pushed onto the expected call queue. If the mock
550 is in replay mode, this will pop a MockMethod off the top of the queue and
551 verify this call is equal to the expected call.
552
553 Raises:
554 UnexpectedMethodCall if this call is supposed to match an expected method
555 call and it does not.
556 """
557
558 self._params = params
559 self._named_params = named_params
560
561 if not self._replay_mode:
562 self._call_queue.append(self)
563 return self
564
565 expected_method = self._VerifyMethodCall()
566
567 if expected_method._side_effects:
568 expected_method._side_effects(*params, **named_params)
569
570 if expected_method._exception:
571 raise expected_method._exception
572
573 return expected_method._return_value
574
575 def __getattr__(self, name):
576 """Raise an AttributeError with a helpful message."""

Callers

nothing calls this directly

Calls 2

_VerifyMethodCallMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected