#NEWLINE# def assert_equal_steps( test_case , expected , actual ) : #NEWLINE# #INDENT# '\n    Assert that the list of provided steps are the same.\n    If they are not, display the differences intelligently.\n\n    :param test_case: The ``TestCase`` whose assert methods will be called.\n    :param expected: The expected build step instance.\n    :param actual: The actual build step instance.\n    :raises: ``TestFailure`` if the build steps are not equal, showing the\n        unequal or missing steps.\n    ' #NEWLINE# expected_steps = getattr ( expected , 'steps' ) #NEWLINE# actual_steps = getattr ( actual , 'steps' ) #NEWLINE# if ( None in ( expected_steps , actual_steps ) ) : #NEWLINE# #INDENT# test_case . assertEqual ( expected , actual ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mismatch_steps = [ ] #NEWLINE# missing_steps = [ ] #NEWLINE# index = 0 #NEWLINE# for ( index , expected_step ) in enumerate ( expected_steps ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# actual_step = actual_steps [ expected_steps ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# missing_steps = expected_steps [ index : ] #NEWLINE# break #NEWLINE# #UNINDENT# if ( expected_step != actual_step ) : #NEWLINE# #INDENT# mismatch_steps . append ( '* expected: {} !=\n  actual:   {}' . format ( expected_step , actual_step ) ) #NEWLINE# #UNINDENT# #UNINDENT# extra_steps = actual_steps [ ( index + 1 ) : ] #NEWLINE# if ( mismatch_steps or missing_steps or extra_steps ) : #NEWLINE# #INDENT# test_case . fail ( 'Step Mismatch\nMismatch:\n{}\nMissing:\n{}\nExtra:\n{}' . format ( '\n' . join ( mismatch_steps ) , missing_steps , extra_steps ) )