def _check_colors(self, collections, linecolors=None, facecolors=None,<EOL>mapping=None):
from matplotlib.lines import Line2D<EOL>from matplotlib.collections import (<EOL>Collection, PolyCollection, LineCollection<EOL>)<EOL>conv = self.colorconverter<EOL>if linecolors is not None:<EOL><INDENT>if mapping is not None:<EOL><INDENT>linecolors = self._get_colors_mapped(mapping, linecolors)<EOL>linecolors = linecolors[:len(collections)]<EOL><DEDENT>assert len(collections) == len(linecolors)<EOL>for patch, color in zip(collections, linecolors):<EOL><INDENT>if isinstance(patch, Line2D):<EOL><INDENT>result = patch.get_color()<EOL>result = conv.to_rgba(result)<EOL><DEDENT>elif isinstance(patch, (PolyCollection, LineCollection)):<EOL><INDENT>result = tuple(patch.get_edgecolor()[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>result = patch.get_edgecolor()<EOL><DEDENT>expected = conv.to_rgba(color)<EOL>assert result == expected<EOL><DEDENT><DEDENT>if facecolors is not None:<EOL><INDENT>if mapping is not None:<EOL><INDENT>facecolors = self._get_colors_mapped(mapping, facecolors)<EOL>facecolors = facecolors[:len(collections)]<EOL><DEDENT>assert len(collections) == len(facecolors)<EOL>for patch, color in zip(collections, facecolors):<EOL><INDENT>if isinstance(patch, Collection):<EOL><INDENT>result = patch.get_facecolor()[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>result = patch.get_facecolor()<EOL><DEDENT>if isinstance(result, np.ndarray):<EOL><INDENT>result = tuple(result)<EOL><DEDENT>expected = conv.to_rgba(color)<EOL>assert result == expected<EOL><DEDENT><DEDENT>
Check each artist has expected line colors and face colors

Parameters
----------
collections : list-like
    list or collection of target artist
linecolors : list-like which has the same length as collections
    list of expected line colors
facecolors : list-like which has the same length as collections
    list of expected face colors
mapping : Series
    Series used for color grouping key
    used for andrew_curves, parallel_coordinates, radviz test