#NEWLINE# def _verify_iteration_topology( iterations ) : #NEWLINE# #INDENT# expected_counter = 0 #NEWLINE# visited_counters = set ( ) #NEWLINE# task = iterations [ 0 ] . assignment . task #NEWLINE# for ( i , iteration ) in enumerate ( iterations ) : #NEWLINE# #INDENT# assignment = iteration . assignment #NEWLINE# assignment_counter = assignment . assignment_counter #NEWLINE# assert ( assignment_counter == expected_counter ) #NEWLINE# visited_counters . add ( assignment . assignment_counter ) #NEWLINE# if ( i == ( len ( iterations ) - 1 ) ) : #NEWLINE# #INDENT# _verify_final_iteration ( iteration ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( iteration . status != Iteration . Status . PROCESSING ) #NEWLINE# #UNINDENT# if ( iteration . status == Iteration . Status . REQUESTED_REVIEW ) : #NEWLINE# #INDENT# expected_counter = ( assignment_counter + 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( iteration . status == Iteration . Status . PROVIDED_REVIEW ) : #NEWLINE# #INDENT# expected_counter = ( assignment_counter - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# assert ( visited_counters == set ( range ( task . assignments . count ( ) ) ) )