4 class PieTest(unittest.TestCase):
9 verify(mock, never()).fakeMethod()
12 def test_neverFail(self):
17 verify(mock, never()).fakeMethod()
18 raise Exception("The fake method was called - the verify statement should fail")
23 def test_onceSuccess(self):
25 given(mock).method().willReturn(True)
27 result = mock.method()
29 verify(mock, once()).method()
32 def test_onceFail(self):
34 given(mock).method().willReturn(True)
37 verify(mock, once()).method()
38 raise Exception("The method was never called - the verify step should fail")
43 def test_implicitOnce_undefinedReturn_WithArguments(self):
46 url = 'http://sample.argument'
48 verify(mock).openUrl(url)
51 if __name__ == '__main__':