Share

pmock

Tracker: Patches

5 OnceOrNeverInvocationMatcher - ID: 2488383
Last Update: Attachment added ( karpuscul )

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


Oleg Sakharov ( karpuscul ) - 2009-01-05 17:39

5

Open

None

Nobody/Anonymous

None

None

Public


Comments




Log in to comment.

No follow-up comments have been posted.

Attached File ( 1 )

Filename Description Download
pmock-0.3.patch01.txt Patch contains OnceOrNeverInvocationMatcher implementation and tests for it Download

Change ( 1 )

Field Old Value Date By
File Added 307887: pmock-0.3.patch01.txt 2009-01-05 17:39 karpuscul