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)
| 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( |
no test coverage detected