#NEWLINE# def test_from_dict_with_callbacks( self ) : #NEWLINE# #INDENT# 'Ensure from_dict reconstructs callbacks correctly.' #NEWLINE# from furious.async import Async #NEWLINE# job = ( 'test' , None , None ) #NEWLINE# callbacks = { #NEWLINE# #INDENT# 'success' : 'furious.tests.test_async.TestAsync.test_to_dict_with_callbacks' , #NEWLINE# 'failure' : 'dir' , #NEWLINE# 'exec' : { #NEWLINE# #INDENT# 'job' : ( 'dir' , None , None ) , #NEWLINE# 'id' : 'petey' , #NEWLINE# 'parent_id' : 'parentid' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# options = { #NEWLINE# #INDENT# 'job' : job , #NEWLINE# 'callbacks' : callbacks , #NEWLINE# 'parent_id' : 'parentid' , #NEWLINE# #UNINDENT# } #NEWLINE# async_job = Async . from_dict ( options ) #NEWLINE# check_callbacks = { #NEWLINE# #INDENT# 'success' : TestAsync . test_to_dict_with_callbacks , #NEWLINE# 'failure' : dir , #NEWLINE# #UNINDENT# } #NEWLINE# callbacks = async_job . get_callbacks ( ) #NEWLINE# exec_callback = callbacks . pop ( 'exec' ) #NEWLINE# correct_options = { #NEWLINE# #INDENT# 'job' : ( 'dir' , None , None ) , #NEWLINE# 'id' : 'petey' , #NEWLINE# 'parent_id' : 'parentid' , #NEWLINE# 'context_id' : None , #NEWLINE# '_recursion' : { #NEWLINE# #INDENT# 'current' : 0 , #NEWLINE# 'max' : 100 , #NEWLINE# #UNINDENT# } , #NEWLINE# '_type' : 'furious.async.Async' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( check_callbacks , callbacks ) #NEWLINE# self . assertEqual ( correct_options , exec_callback . to_dict ( ) )