#NEWLINE# def test_style( self ) : #NEWLINE# #INDENT# array = [ [ '0' , '0' , '0' , '1' , '0' ] , [ ' ' , ' ' , '2' , '0' , '1' ] , [ '1' , '1' , '2' , '1' , '3' ] ] #NEWLINE# colormap = { #NEWLINE# #INDENT# ' ' : 'black' , #NEWLINE# '0' : 'blue' , #NEWLINE# '1' : 'yellow' , #NEWLINE# '2' : 'white' , #NEWLINE# '3' : 'red' , #NEWLINE# #UNINDENT# } #NEWLINE# expected = [ ] #NEWLINE# for row in array : #NEWLINE# #INDENT# o_row = [ ] #NEWLINE# for char in row : #NEWLINE# #INDENT# color = gj2ascii . ANSI_COLORMAP [ colormap [ char ] ] #NEWLINE# o_row . append ( ( ( ( color + char ) + ' ' ) + gj2ascii . core . _ANSI_RESET ) ) #NEWLINE# #UNINDENT# expected . append ( '' . join ( colormap ) ) #NEWLINE# #UNINDENT# expected = os . linesep . join ( expected ) #NEWLINE# self . assertEqual ( expected , gj2ascii . style ( gj2ascii . array2ascii ( array ) , stylemap = colormap ) )