Raised when an unexpected method is called. This can occur if a method is called with incorrect parameters, or out of the specified order.
| 100 | |
| 101 | |
| 102 | class UnexpectedMethodCallError(Error): |
| 103 | """Raised when an unexpected method is called. |
| 104 | |
| 105 | This can occur if a method is called with incorrect parameters, or out of the |
| 106 | specified order. |
| 107 | """ |
| 108 | |
| 109 | def __init__(self, unexpected_method, expected): |
| 110 | """Init exception. |
| 111 | |
| 112 | Args: |
| 113 | # unexpected_method: MockMethod that was called but was not at the head of |
| 114 | # the expected_method queue. |
| 115 | # expected: MockMethod or UnorderedGroup the method should have |
| 116 | # been in. |
| 117 | unexpected_method: MockMethod |
| 118 | expected: MockMethod or UnorderedGroup |
| 119 | """ |
| 120 | |
| 121 | Error.__init__(self) |
| 122 | self._unexpected_method = unexpected_method |
| 123 | self._expected = expected |
| 124 | |
| 125 | def __str__(self): |
| 126 | return "Unexpected method call: %s. Expecting: %s" % \ |
| 127 | (self._unexpected_method, self._expected) |
| 128 | |
| 129 | |
| 130 | class UnknownMethodCallError(Error): |
no outgoing calls
no test coverage detected