#NEWLINE# def _check_colors( collection , expected_colors , alpha = None ) : #NEWLINE# #INDENT# from matplotlib.lines import Line2D #NEWLINE# import matplotlib.colors as colors #NEWLINE# conv = colors . colorConverter #NEWLINE# for ( patch , color ) in zip ( collection , expected_colors ) : #NEWLINE# #INDENT# if isinstance ( patch , Line2D ) : #NEWLINE# #INDENT# result = patch . get_color ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = patch . get_facecolor ( ) #NEWLINE# #UNINDENT# assert ( conv . to_rgba ( result ) == conv . to_rgba ( color , alpha = alpha ) )