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

Method _VerifyMethodCall

deps/protobuf/python/mox.py:588–613  ·  view source on GitHub ↗

Verify the called method is expected. This can be an ordered method, or part of an unordered set. Returns: The expected mock method. Raises: UnexpectedMethodCall if the method called was not expected.

(self)

Source from the content-addressed store, hash-verified

586 raise UnexpectedMethodCallError(self, None)
587
588 def _VerifyMethodCall(self):
589 """Verify the called method is expected.
590
591 This can be an ordered method, or part of an unordered set.
592
593 Returns:
594 The expected mock method.
595
596 Raises:
597 UnexpectedMethodCall if the method called was not expected.
598 """
599
600 expected = self._PopNextMethod()
601
602 # Loop here, because we might have a MethodGroup followed by another
603 # group.
604 while isinstance(expected, MethodGroup):
605 expected, method = expected.MethodCalled(self)
606 if method is not None:
607 return method
608
609 # This is a mock method, so just check equality.
610 if expected != self:
611 raise UnexpectedMethodCallError(self, expected)
612
613 return expected
614
615 def __str__(self):
616 params = ', '.join(

Callers 1

__call__Method · 0.95

Calls 4

_PopNextMethodMethod · 0.95
isinstanceFunction · 0.85
MethodCalledMethod · 0.45

Tested by

no test coverage detected