예제 #1
0
 def test_1CallbacksAdded2Times_RemoveTheAddedCallback2Times(self):
     callback = FakeCreatedCallbackTester(self)
     fakeable.add_created_callback(callback)
     fakeable.add_created_callback(callback)
     retval1 = fakeable.remove_created_callback(callback)
     self.assertIs(retval1, True)
     retval2 = fakeable.remove_created_callback(callback)
     self.assertIs(retval2, True)
     MyCoolClass()
     callback.assert_invocation_count(0)
예제 #2
0
 def test_2CallbacksAdded_RemoveBothAddedCallbacks(self):
     callback1 = FakeCreatedCallbackTester(self)
     callback2 = FakeCreatedCallbackTester(self)
     fakeable.add_created_callback(callback1)
     fakeable.add_created_callback(callback2)
     retval1 = fakeable.remove_created_callback(callback1)
     self.assertIs(retval1, True)
     retval2 = fakeable.remove_created_callback(callback2)
     self.assertIs(retval2, True)
     MyCoolClass()
     callback1.assert_invocation_count(0)
     callback2.assert_invocation_count(0)
예제 #3
0
 def test_1CallbacksAdded_RemoveNeverAddedCallback(self):
     callback = FakeCreatedCallbackTester(self)
     fakeable.add_created_callback(callback)
     retval = fakeable.remove_created_callback(object())
     self.assertIs(retval, False)
     MyCoolClass()
     callback.assert_invoked_exactly_once()
예제 #4
0
 def test_1CallbacksAdded2Times_RemoveTheAddedCallback1Time(self):
     callback = FakeCreatedCallbackTester(self)
     fakeable.add_created_callback(callback)
     fakeable.add_created_callback(callback)
     retval = fakeable.remove_created_callback(callback)
     self.assertIs(retval, True)
     MyCoolClass()
     callback.assert_invoked_exactly_once()
예제 #5
0
 def test_2CallbacksAdded_Remove2ndAddedCallback(self):
     callback1 = FakeCreatedCallbackTester(self)
     callback2 = FakeCreatedCallbackTester(self)
     fakeable.add_created_callback(callback1)
     fakeable.add_created_callback(callback2)
     retval = fakeable.remove_created_callback(callback2)
     self.assertIs(retval, True)
     MyCoolClass()
     callback1.assert_invoked_exactly_once()
     callback2.assert_invocation_count(0)