#NEWLINE# @ mock . patch ( ( PLOT + 'objects.Task.extend_results' ) ) #NEWLINE# def test__extend_results( self , mock_task_extend_results ) : #NEWLINE# #INDENT# mock_task_extend_results . side_effect = iter ( [ [ 'extended_foo' ] , [ 'extended_bar' ] , [ 'extended_spam' ] ] ) #NEWLINE# tasks_results = [ { #NEWLINE# #INDENT# 'key' : ( '%s_key' % k ) , #NEWLINE# 'sla' : ( '%s_sla' % k ) , #NEWLINE# 'full_duration' : ( '%s_full_duration' % k ) , #NEWLINE# 'load_duration' : ( '%s_load_duration' % k ) , #NEWLINE# 'result' : ( '%s_result' % k ) , #NEWLINE# #UNINDENT# } for k in ( 'foo' , 'bar' , 'spam' ) ] #NEWLINE# generic_results = [ { #NEWLINE# #INDENT# 'id' : None , #NEWLINE# 'created_at' : None , #NEWLINE# 'updated_at' : None , #NEWLINE# 'task_uuid' : None , #NEWLINE# 'key' : ( '%s_key' % k ) , #NEWLINE# 'data' : { #NEWLINE# #INDENT# 'raw' : ( '%s_result' % k ) , #NEWLINE# 'full_duration' : ( '%s_full_duration' % k ) , #NEWLINE# 'load_duration' : ( '%s_load_duration' % k ) , #NEWLINE# 'sla' : ( '%s_sla' % k ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } for k in ( 'foo' , 'bar' , 'spam' ) ] #NEWLINE# results = plot . _extend_results ( tasks_results ) #NEWLINE# self . assertEqual ( [ mock . call ( [ r ] ) for r in generic_results ] , mock_task_extend_results . mock_calls ) #NEWLINE# self . assertEqual ( [ 'extended_foo' , 'extended_bar' , 'extended_spam' ] , results )