#NEWLINE# def test_diff_modified_items( ) : #NEWLINE# #INDENT# header_item = { #NEWLINE# #INDENT# 'state' : 'modified' , #NEWLINE# 'originalvalue' : CellComparator ( { #NEWLINE# #INDENT# 'cell_type' : 'heading' , #NEWLINE# 'source' : 'This is a header' , #NEWLINE# #UNINDENT# } ) , #NEWLINE# 'modifiedvalue' : CellComparator ( { #NEWLINE# #INDENT# 'cell_type' : 'heading' , #NEWLINE# 'source' : 'This is a different header' , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } #NEWLINE# code_item = { #NEWLINE# #INDENT# 'state' : 'modified' , #NEWLINE# 'originalvalue' : CellComparator ( { #NEWLINE# #INDENT# 'cell_type' : 'code' , #NEWLINE# 'input' : 'x = 10\ny = 10\n' , #NEWLINE# #UNINDENT# } ) , #NEWLINE# 'modifiedvalue' : CellComparator ( { #NEWLINE# #INDENT# 'cell_type' : 'code' , #NEWLINE# 'input' : 'x = 11\ny = 10\n' , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } #NEWLINE# cellslist = [ { #NEWLINE# #INDENT# 'state' : 'added' , #NEWLINE# 'value' : 'foo' , #NEWLINE# #UNINDENT# } , header_item , code_item ] #NEWLINE# result = diff_modified_items ( cellslist ) #NEWLINE# assert ( 0 not in result ) #NEWLINE# assert ( len ( result [ 1 ] ) == 5 ) #NEWLINE# assert ( len ( result [ 2 ] ) == 3 )