예제 #1
0
 def test_addBothSuccessExtraArgs(self):
     """
     addBoth takes extra arguments, and they get passed in the success case.
     """
     sd = SynchronousDeferred("foo")
     l = []
     def cb(r, extra, more=None):
         l.append((r, extra, more))
     sd.addBoth(cb, 1, more="heyo")
     self.assertEquals(l, [("foo", 1, "heyo")])
예제 #2
0
 def test_addBothFailureExctraArgs(self):
     """
     addBoth adds a callback to be run on success.
     """
     failure = SynchronousFailure(RuntimeError())
     sd = SynchronousDeferred(failure)
     l = []
     def eb(r, extra, more=None):
         l.append((r, extra, more))
     sd.addBoth(eb, 1, more="heyo")
     self.assertEquals(l, [(failure, 1, "heyo")])
예제 #3
0
 def test_addBothSuccess(self):
     """
     addBoth adds a callback to be run on success.
     """
     l = []
     sd = SynchronousDeferred("foo")
     self.assertEquals(sd.addBoth(l.append), sd)
     self.assertEquals(l, ["foo"])