#NEWLINE# def test_create_file( self ) : #NEWLINE# #INDENT# 'Test the creation of a simple XlsxWriter file with conditional formatting.' #NEWLINE# workbook = Workbook ( self . got_filename ) #NEWLINE# worksheet = workbook . add_worksheet ( ) #NEWLINE# format1 = workbook . add_format ( { #NEWLINE# #INDENT# 'bg_color' : '#FF0000' , #NEWLINE# 'dxf_index' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# format2 = workbook . add_format ( { #NEWLINE# #INDENT# 'bg_color' : '#92D050' , #NEWLINE# 'dxf_index' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = [ [ 90 , 80 , 50 , 10 , 20 , 90 , 40 , 90 , 30 , 40 ] , [ 20 , 10 , 90 , 100 , 30 , 60 , 70 , 60 , 50 , 90 ] , [ 10 , 50 , 60 , 50 , 20 , 50 , 80 , 30 , 40 , 60 ] , [ 10 , 90 , 20 , 40 , 10 , 40 , 50 , 70 , 90 , 50 ] , [ 70 , 100 , 10 , 90 , 10 , 10 , 20 , 100 , 100 , 40 ] , [ 20 , 60 , 10 , 100 , 30 , 10 , 20 , 60 , 100 , 10 ] , [ 10 , 60 , 10 , 80 , 100 , 80 , 30 , 30 , 70 , 40 ] , [ 30 , 90 , 60 , 10 , 10 , 100 , 40 , 40 , 30 , 40 ] , [ 80 , 90 , 10 , 20 , 20 , 50 , 80 , 20 , 60 , 90 ] , [ 60 , 80 , 30 , 30 , 10 , 50 , 80 , 60 , 50 , 30 ] ] #NEWLINE# for ( row , row_data ) in enumerate ( data ) : #NEWLINE# #INDENT# worksheet . write_row ( row , 0 , row_data ) #NEWLINE# row += 1 #NEWLINE# #UNINDENT# worksheet . conditional_format ( 'A1:J10' , { #NEWLINE# #INDENT# 'type' : 'cell' , #NEWLINE# 'format' : format1 , #NEWLINE# 'criteria' : '>=' , #NEWLINE# 'value' : 50 , #NEWLINE# #UNINDENT# } ) #NEWLINE# worksheet . conditional_format ( 'A1:J10' , { #NEWLINE# #INDENT# 'type' : 'cell' , #NEWLINE# 'format' : format2 , #NEWLINE# 'criteria' : '<' , #NEWLINE# 'value' : 50 , #NEWLINE# #UNINDENT# } ) #NEWLINE# workbook . close ( ) #NEWLINE# self . assertExcelEqual ( )