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

Method MethodCalled

deps/protobuf/python/mox.py:1285–1316  ·  view source on GitHub ↗

Remove a method call from the group. If the method is not in the set, an UnexpectedMethodCallError will be raised. Args: mock_method: a mock method that should be equal to a method in the group. Returns: The mock method from the group Raises: UnexpectedMetho

(self, mock_method)

Source from the content-addressed store, hash-verified

1283 self._methods.add(mock_method)
1284
1285 def MethodCalled(self, mock_method):
1286 """Remove a method call from the group.
1287
1288 If the method is not in the set, an UnexpectedMethodCallError will be
1289 raised.
1290
1291 Args:
1292 mock_method: a mock method that should be equal to a method in the group.
1293
1294 Returns:
1295 The mock method from the group
1296
1297 Raises:
1298 UnexpectedMethodCallError if the mock_method was not in the group.
1299 """
1300
1301 # Check to see if this method exists, and if so add it to the set of
1302 # called methods.
1303
1304 for method in self._methods:
1305 if method == mock_method:
1306 self._methods_called.add(mock_method)
1307 # Always put this group back on top of the queue, because we don't know
1308 # when we are done.
1309 mock_method._call_queue.appendleft(self)
1310 return self, method
1311
1312 if self.IsSatisfied():
1313 next_method = mock_method._PopNextMethod();
1314 return next_method, None
1315 else:
1316 raise UnexpectedMethodCallError(mock_method, self)
1317
1318 def IsSatisfied(self):
1319 """Return True if all methods in this group are called at least once."""

Callers

nothing calls this directly

Calls 4

IsSatisfiedMethod · 0.95
_PopNextMethodMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected