ó
áp7]c           @   s•   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
 y d  d l j Z Wn e k
 rz n Xd e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   assert_raisest   assert_equal(   t   Series(   t   interaction_plott   _recodet   TestInteractionPlotc           B   s¹   e  Z e d  „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j e j j	 d d d g ƒ d „  ƒ ƒ Z
 e j j d „  ƒ Z e j j d „  ƒ Z e j j d	 „  ƒ Z d
 „  Z RS(   c         C   sw   t  j j d ƒ t  j j d d d d ƒ|  _ t  j j d d d d ƒ|  _ t  j t  j j d d d d ƒƒ |  _ d  S(   Ni90  i   i   t   sizei<   i   i   (   t   npt   randomt   seedt   randintt   weightt   durationt   logt   days(   t   cls(    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   setup_class   s    c      
   C   s=   t  |  j |  j |  j d d d g d d d g d d ƒ} d  S(	   Nt   colorst   redt   bluet   markerst   Dt   ^t   msi
   (   R   R   R   R   (   t   selft   close_figurest   fig(    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_plot_both   s    c         C   s1   t  |  j |  j |  j d d d g d d ƒ} d  S(   NR   R   R   R   i
   (   R   R   R   R   (   R   R   R   (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_plot_rainbow   s    t   astypet   strt   intc   	      C   sÈ   t  |  j d d ƒj | ƒ } t  |  j d d ƒ} t  |  j d d ƒ} t | | | d d d g d d	 ƒ} | j d
 } | j ƒ  j ƒ  j	 ƒ  } t
 | d ƒ t
 | j ƒ  d ƒ t
 | j ƒ  d ƒ d  S(   Nt   namet   Weightt   Durationt   DaysR   R   R   R   i
   i    s   mean of Days(   R   R   R   R   R   R   t   axest
   get_legendt	   get_titlet   get_textR   t
   get_ylabelt
   get_xlabel(	   R   R   R   R   R   R   R   t   axt   trace(    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_plot_pandas!   s    c      	   C   sP   t  |  j |  j |  j d d d g d d d g ƒ} t t | t j ƒ t ƒ d  S(   NR   t   rt   gt
   linestyless   --s   -.(	   R   R   R   R   R   t
   isinstancet   pltt   Figuret   True(   R   R   R   (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_formatting/   s    3c      
   C   sˆ   t  t t |  j |  j |  j d d g ƒt  t t |  j |  j |  j d d d d g ƒt  t t |  j |  j |  j d d d	 d
 g ƒd  S(   NR   R   R   t   bR-   R.   R/   s   --s   -.t   :(   R    t
   ValueErrorR   R   R   R   (   R   R   (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_formatting_errors4   s    (.c         C   s   t  |  j |  j |  j d d ƒ} t t | t j ƒ t ƒ t  |  j |  j |  j d d ƒ} t t | t j ƒ t ƒ t	 t
 t  |  j |  j |  j d d ƒd  S(   Nt   plottypet   linet   scattert   unknown(   R   R   R   R   R   R0   R1   R2   R3   R    R7   (   R   R   R   (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_plottype:   s
    !!c         C   sq   t  d d g d d t j d d d ƒ d d	 ƒ} t | i d d 6d
 d 6ƒ } t | j j | j j d d ƒd  S(   Nt   aR5   i
   t   indexi    i(   i   R    t
   index_testi   t   err_msgs   _recode changed the index(   R   R   t   arangeR   R   R?   t   values(   R   t   seriest   series_(    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   test_recode_seriesB   s
    (	(   t   __name__t
   __module__t   classmethodR   t   pytestt   markt
   matplotlibR   R   t   parametrizeR,   R4   R8   R=   RF   (    (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyR      s   	'(   t   numpyR   t   numpy.testingR    R   t   pandasR   RJ   t    statsmodels.graphics.factorplotsR   R   t   matplotlib.pyplott   pyplotR1   t   ImportErrort   objectR   (    (    (    sJ   lib/python2.7/site-packages/statsmodels/graphics/tests/test_factorplots.pyt   <module>   s   