#NEWLINE# def test_cancel( self ) : #NEWLINE# #INDENT# '\n        cancel() cancels the wrapped Deferred, running cancellation in the\n        event loop thread.\n        ' #NEWLINE# reactor = FakeReactor ( ) #NEWLINE# cancelled = [ ] #NEWLINE# def error( f ) : #NEWLINE# #INDENT# cancelled . append ( reactor . in_call_from_thread ) #NEWLINE# cancelled . append ( f ) #NEWLINE# #UNINDENT# d = Deferred ( ) . addErrback ( error ) #NEWLINE# dr = EventualResult ( d , _reactor = reactor ) #NEWLINE# dr . cancel ( ) #NEWLINE# self . assertTrue ( cancelled [ 0 ] ) #NEWLINE# self . assertIsInstance ( error [ 1 ] . value , CancelledError )