Skip to content

Instantly share code, notes, and snippets.

@markrwilliams
Created June 9, 2019 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrwilliams/766088476387791b5b084c97869f6062 to your computer and use it in GitHub Desktop.
Save markrwilliams/766088476387791b5b084c97869f6062 to your computer and use it in GitHub Desktop.
from twisted.internet.defer import Deferred
from twisted.trial.unittest import TestCase
class Race(TestCase):
def test_thing(self):
outer, inner = Deferred(), Deferred()
def raiser(_):
raise ValueError()
inner.callback(1)
outer.callback(2)
outer.addCallback(lambda _: inner)
inner.addCallback(raiser)
return outer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment