U
    sVc4                     @   s<   d dl Z d dlmZ e d d dlmZ G dd dZdS )    N)Series
matplotlib)get_standard_colorsc                   @   st  e Zd Zejdddddgfddddddgfddddddddgfdddgfd	dgfgd
d Zejdd	dgfddddgfdddddgfddddddgfddddddddgfgdd Zejdd	dgfddddgfdddddddddddddgfgdd  Zejdd	ddd!gfdddd!gfdddd!gfdddd!dgfgd"d# Z	ejdd	dddd$gfddddd$gfddddd$gfddddd$gfddddd$dgfd%dddd$ddgfgd&d' Z
ejdd	d!gfdd!d!gfdd!d!d!gfgd(d) Zejd*d+d	d+gfd,dd,d,gfd-dd-d-d-gfgd.d/ Zejd0d1g d2eg d3d4gd5d6 Zejd0d7d8d9d:d;gd<d= Zd>S )?TestGetStandardColorsznum_colors, expected   redgreenblue            c              	   C   sZ   dd l }ddlm} d|dddgdi}|j|d t|d	}||ksLtW 5 Q R X d S )
Nr   cycleraxes.prop_cycler   r   r	   colorrc
num_colorsr   Zmatplotlib.pyplotr   
rc_contextr   AssertionErrorselfr   expectedmplr   Z
mpl_paramsresult r   D/tmp/pip-unpacked-wheel-xj8nt62q/pandas/tests/plotting/test_style.py)test_default_colors_named_from_prop_cycle
   s     
z?TestGetStandardColors.test_default_colors_named_from_prop_cyclebgr   yc              	   C   sT   dd l }ddlm} d|ddi}|j|d t|d}||ksFtW 5 Q R X d S )Nr   r   r   Zbgryr   r   r   r   r   r   r   r    0test_default_colors_named_from_prop_cycle_string   s     
zFTestGetStandardColors.test_default_colors_named_from_prop_cycle_stringznum_colors, expected_nameZC0ZC1ZC2   ZC3ZC4ZC5ZC6ZC7ZC8ZC9c              	      sX   dd l }dd lm  |ji d.  fdd|D }t|d}||ksJtW 5 Q R X d S )Nr   r   c                    s   g | ]}  |qS r   )Zto_hex).0xZmcolorsr   r    
<listcomp>Q   s     zXTestGetStandardColors.test_default_colors_named_undefined_prop_cycle.<locals>.<listcomp>r   )r   Zmatplotlib.colorscolorsr   r   r   )r   r   Zexpected_namer   r   r   r   r+   r    .test_default_colors_named_undefined_prop_cycle4   s    
zDTestGetStandardColors.test_default_colors_named_undefined_prop_cycle皙?皙?333333?c                 C   s&   dddg}t ||d}||ks"td S )Nr   r   r/   r   r   r   r   r   r   r   r   r   r   r   r    test_user_input_color_sequenceU   s    

z4TestGetStandardColors.test_user_input_color_sequencek   c                 C   s    d}t ||d}||kstd S )NZrgbkr3   r4   r5   r   r   r    test_user_input_color_stringc   s    z2TestGetStandardColors.test_user_input_color_stringc                 C   s    d}t ||d}||kstd S )Nr/   r3   r4   r5   r   r   r    test_user_input_color_floatss   s    	z2TestGetStandardColors.test_user_input_color_floatszcolor, num_colors, expectedZCrimsonZ
DodgerBlueZ	firebrickc                 C   s   t ||d}||kstd S )Nr3   r4   )r   r   r   r   r   r   r   r    "test_user_input_named_color_string   s    	z8TestGetStandardColors.test_user_input_named_color_stringr    r   object)Zdtypec              	   C   s*   t jtdd t|dd W 5 Q R X d S )NzInvalid color argumentmatchr   r3   pytestZraises
ValueErrorr   r   r   r   r   r    test_empty_color_raises   s    z-TestGetStandardColors.test_empty_color_raises	bad_color)r   r   rE   )r0   )r0   r1   )r0   r1   r2   g?g      ?c              	   C   s*   t jtdd t|dd W 5 Q R X d S )NzInvalid colorr>   r
   r3   r@   rC   r   r   r    test_bad_color_raises   s    z+TestGetStandardColors.test_bad_color_raisesN)__name__
__module____qualname__rA   markZparametrizer!   r'   r.   r6   r9   r:   r;   r   rD   rF   r   r   r   r    r   	   s   





		







r   )rA   Zpandasr   ZimportorskipZ!pandas.plotting._matplotlib.styler   r   r   r   r   r    <module>   s   
