Exemplo n.º 1
0
 def test_success(self):
     d1, d2 = defer.Deferred(), defer.Deferred()
     good = []
     bad = []
     dlss = deferredutil.DeferredListShouldSucceed([d1, d2])
     dlss.addCallbacks(good.append, bad.append)
     d1.callback(1)
     d2.callback(2)
     self.failUnlessEqual(good, [[1, 2]])
     self.failUnlessEqual(bad, [])
Exemplo n.º 2
0
 def test_failure(self):
     d1, d2 = defer.Deferred(), defer.Deferred()
     good = []
     bad = []
     dlss = deferredutil.DeferredListShouldSucceed([d1, d2])
     dlss.addCallbacks(good.append, bad.append)
     d1.addErrback(lambda _ignore: None)
     d2.addErrback(lambda _ignore: None)
     d1.callback(1)
     d2.errback(ValueError())
     self.failUnlessEqual(good, [])
     self.failUnlessEqual(len(bad), 1)
     f = bad[0]
     self.failUnless(isinstance(f, Failure))
     self.failUnless(f.check(ValueError))