U
    md                     @   st   d dl Zd dlmZmZ d dlmZ d dlZd dlm	Z	m
Z
 zd dlmZ W n ek
r`   Y nX G dd dZdS )    N)assert_equalassert_raises)Series)_recodeinteraction_plotc                   @   s   e Zd Zedd Zejjdd Zejjdd Z	ejjej
ddd	gd
d Zejjdd Zejjdd Zejjdd Zdd ZdS )TestInteractionPlotc                 C   sR   t jd t jjdddd| _t jjdddd| _t t jjdddd| _d S )Ni90        <   )size      )nprandomseedrandintweightdurationlogdays)cls r   d/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/statsmodels/graphics/tests/test_factorplots.pysetup_class   s    zTestInteractionPlot.setup_classc                 C   s&   t | j| j| jddgddgdd}d S )NredblueD^
   )colorsmarkersmsr   r   r   r   selfclose_figuresfigr   r   r   test_plot_both   s
      z"TestInteractionPlot.test_plot_bothc                 C   s    t | j| j| jddgdd}d S )Nr   r   r   r    r!   r"   r#   r   r   r   test_plot_rainbow   s     z%TestInteractionPlot.test_plot_rainbowastypestrintc           	      C   s   t | jdd|}t | jdd}t | jdd}t|||ddgdd}|jd	 }|  	 }t
|d t
| d
 t
| d d S )NZWeight)nameZDurationZDaysr   r   r   r(   r   zmean of Days)r   r   r*   r   r   r   ZaxesZ
get_legendZ	get_titleZget_textr   Z
get_ylabelZ
get_xlabel)	r$   r*   r%   r   r   r   r&   Zaxtracer   r   r   test_plot_pandas!   s     

z$TestInteractionPlot.test_plot_pandasc                 C   s6   t | j| j| jddgddgd}tt|tjd d S )Nrg---.)r   
linestylesT)r   r   r   r   r   
isinstancepltFigurer#   r   r   r   test_formatting/   s     z#TestInteractionPlot.test_formattingc              	   C   s`   t tt| j| j| jdgd t tt| j| j| jdddgd t tt| j| j| jddd	gd
 d S )Nr   )r    br0   r1   )r   r2   r3   :)r4   )r   
ValueErrorr   r   r   r   )r$   r%   r   r   r   test_formatting_errors4   s     z*TestInteractionPlot.test_formatting_errorsc                 C   sn   t | j| j| jdd}tt|tjd t | j| j| jdd}tt|tjd tt	t | j| j| jdd d S )Nline)ZplottypeTZscatterunknown)
r   r   r   r   r   r5   r6   r7   r   r;   r#   r   r   r   test_plottype:   s
    z!TestInteractionPlot.test_plottypec                 C   sJ   t ddgd tddddd}t|dd	d
}t|jj|jjdd d S )Nar9   r   r   (      Z
index_test)indexr-   r   )r@   r9   z_recode changed the index)err_msg)r   r   Zaranger   r   rC   values)r$   ZseriesZseries_r   r   r   test_recode_seriesB   s    z&TestInteractionPlot.test_recode_seriesN)__name__
__module____qualname__classmethodr   pytestmarkZ
matplotlibr'   r)   Zparametrizer/   r8   r<   r?   rF   r   r   r   r   r      s    





r   )numpyr   Znumpy.testingr   r   Zpandasr   rK   Z statsmodels.graphics.factorplotsr   r   Zmatplotlib.pyplotZpyplotr6   ImportErrorr   r   r   r   r   <module>   s   