ó
áp7]c           @   s£   d  Z  d d l m Z d d l j Z d d l Z d d l m Z d d d d g Z	 d	 „  Z
 e
 d
 e	 ƒ Z e
 d e	 ƒ Z d e f d „  ƒ  YZ d e d „ Z d S(   s0   assert functions from numpy and pandas testing

iÿÿÿÿ(   t   testingN(   t   Buncht   paramst   bset   tvaluest   pvaluesc            s&   d t  f ‡  ‡ ‡ f d †  ƒ  Y‰  ˆ  S(   s­  
    Generates a special purpose Bunch class

    Parameters
    ----------
    attribute: str
        Attribute to access when splitting
    columns: List[str]
        List of names to use when splitting the columns of attribute

    Notes
    -----
    After the class is initialized as a Bunch, the columne of attribute
    are split so that Bunch has the keys in columns and
    bunch[column[i]] = bunch[attribute][:, i]
    t   FactoryBunchc              s   e  Z ‡  ‡ ‡ f d  †  Z RS(   c            s„   t  ˆ  |  ƒ j | | Ž  t |  ˆ ƒ s@ t d j ˆ ƒ ƒ ‚ n  x= t ˆ ƒ D]/ \ } } t |  ˆ ƒ d  d  … | f |  | <qM Wd  S(   Ns5   {0} is required and must be passed to the constructor(   t   supert   __init__t   hasattrt   AttributeErrort   formatt	   enumeratet   getattr(   t   selft   argst   kwargst   it   att(   R   t	   attributet   columns(    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyR   !   s    	(   t   __name__t
   __module__R   (    (   R   R   R   (    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyR       s   (   R   (   R   R   (    (   R   R   R   s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyt   bunch_factory   s    "	t   params_tablet   margins_tablet   Holderc           B   s   e  Z d  Z d „  Z RS(   sF   
    Test-focused class to simplify accessing values by attribute
    c         K   s   |  j  j | ƒ d  S(   N(   t   __dict__t   update(   R   t   kwds(    (    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyR   5   s    (   R   R   t   __doc__R   (    (    (    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyR   1   s   t    c         K   s•   t  | t j ƒ r% t j |  | ƒ nl t  | t j ƒ rM t j |  | |  nD t  | t j ƒ ru t j |  | |  n t	 j
 |  | d d d t ƒd  S(   Nt   err_msgR   t   verbose(   t
   isinstancet   pandast   Indext   pdtt   assert_index_equalt   Seriest   assert_series_equalt	   DataFramet   assert_frame_equalt   nptt   assert_equalt   True(   t   actualt   desiredR    R!   R   (    (    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyR,   ;   s    (   R   t   statsmodels.compat.pandasR    R%   t   numpy.testingR+   R#   t   statsmodels.tools.toolsR   t
   PARAM_LISTR   t   ParamsTableTestBuncht   MarginTableTestBuncht   objectR   R-   R,   (    (    (    s8   lib/python2.7/site-packages/statsmodels/tools/testing.pyt   <module>   s   	
