#NEWLINE# def _verify_iteration_datetimes( iterations ) : #NEWLINE# #INDENT# '\n    Verifies correct start and end datetimes for ordered iterations.\n    ' #NEWLINE# for iteration in iterations : #NEWLINE# #INDENT# assignment = iteration . assignment #NEWLINE# siblings = assignment . iterations . order_by ( 'start_datetime' ) #NEWLINE# if ( siblings . first ( ) == iteration ) : #NEWLINE# #INDENT# expected_start_datetime = assignment . start_datetime #NEWLINE# #UNINDENT# assert ( iteration . start_datetime == expected_start_datetime ) #NEWLINE# expected_start_datetime = expected_start_datetime . end_datetime #NEWLINE# if ( iteration . status == Iteration . Status . PROCESSING ) : #NEWLINE# #INDENT# assert ( not iteration . end_datetime )