There were only three Invocation Matchers in pmock version 0.3:
- OnceInvocationMatcher (method once())
- AtLeastOnceInvocationMatcher (method at_least_once())
- NeverInvocationMatcher (method never())
I've added the fourth one:
- OnceOrNeverInvocationMatcher (method once_or_never())
The actual behaviour of the matcher is shown by the test:
class OnceOrNeverTest(unittest.TestCase):
def setUp(self):
self.mock = pmock.Mock()
self.mock.expects(pmock.once_or_never()).method("rabbit")
def test_uncalled(self):
self.mock.verify()
def test_call_once(self):
self.mock.proxy().rabbit()
self.mock.verify()
def test_call_too_many(self):
self.mock.proxy().rabbit()
try:
self.mock.proxy().rabbit()
self.fail()
except pmock.MatchError:
pass
Nobody/Anonymous
None
None
Public
| Filename | Description | Download |
|---|---|---|
| pmock-0.3.patch01.txt | Patch contains OnceOrNeverInvocationMatcher implementation and tests for it | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| File Added | 307887: pmock-0.3.patch01.txt | 2009-01-05 17:39 | karpuscul |