
    M/Phx	                         d Z ddlmZ ddlmZ ddlZddlmZ g dZ	d Z
 e
de	          Z e
de	          Z G d	 d
          ZddZdS )z0assert functions from numpy and pandas testing

    )testingNBunch)paramsbsetvaluespvaluesc                 6      G  fddt                     }|S )a  
    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]
    c                   $     e Zd Z fdZ xZS )#bunch_factory.<locals>.FactoryBunchc                     t                      j        |i | t          |           s"t          d                                        t                    D ]"\  }}t          |           d d |f         | |<   #d S )Nz4{} is required and must be passed to the constructor)super__init__hasattrAttributeErrorformat	enumerategetattr)selfargskwargsiatt	__class__	attributecolumnss        Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/tools/testing.pyr   z,bunch_factory.<locals>.FactoryBunch.__init__!   s    EGGd-f---4++ J$ &77=vi7H7HJ J J#G,, ; ;3#D)44QQQT:S		; ;    )__name__
__module____qualname__r   __classcell__)r   r   r   s   @r   FactoryBunchr       sC        	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;r   r#   r   )r   r   r#   s   `` r   bunch_factoryr$      sE    "; ; ; ; ; ; ; ;u ; ; ; r   params_tablemargins_tablec                   $    e Zd ZdZd Zd Zd ZdS )HolderzF
    Test-focused class to simplify accessing values by attribute
    c                 :    | j                             |           d S )N)__dict__update)r   kwdss     r   r   zHolder.__init__5   s    T"""""r   c                     d                     d t          |                                           D                       }|S )N
c              3      K   | ]=\  }}t          |          d z   t          |                              dd          z   V  >dS z = r.   z
    N)strreplace.0kvs      r   	<genexpr>z!Holder.__str__.<locals>.<genexpr>9   s]       7 71a 1vv~AtX(F(FF 7 7 7 7 7 7r   )joinvarsitemsr   sss     r   __str__zHolder.__str__8   sH    YY 7 7#'::#3#3#5#57 7 7 7 7	r   c                     d                     d t          |                                           D                       }t          | j                  dz   |z   }|S )Nr.   c              3      K   | ]=\  }}t          |          d z   t          |                              dd          z   V  >dS r0   )r1   reprr2   r3   s      r   r7   z"Holder.__repr__.<locals>.<genexpr>?   s]       7 71a 1vv~Qh(G(GG 7 7 7 7 7 7r   )r8   r9   r:   r1   r   r;   s     r   __repr__zHolder.__repr__=   sa    YY 7 7#'::#3#3#5#57 7 7 7 7  4'",	r   N)r   r    r!   __doc__r   r=   rA    r   r   r(   r(   1   sK         # # #  
    r   r(    Tc                 T   t          |t          j                  rt          j        | |           d S t          |t          j                  rt          j        | |fi | d S t          |t          j                  rt          j        | |fi | d S t          j
        | |dd           d S )NrD   T)err_msgverbose)
isinstancepandasIndexpdtassert_index_equalSeriesassert_series_equal	DataFrameassert_frame_equalnptassert_equal)actualdesiredrF   rG   r,   s        r   rR   rR   G   s    '6<(( Dvw/////	GV]	+	+ D88488888	GV-	.	. Dvw77$77777"dCCCCCCr   )rD   T)rB   statsmodels.compat.pandasr   rK   numpy.testingrQ   rI   statsmodels.tools.toolsr   
PARAM_LISTr$   ParamsTableTestBunchMarginTableTestBunchr(   rR   rC   r   r   <module>r[      s     5 4 4 4 4 4        ) ) ) ) ) ) 544
  : %}^Z@@ $}_jAA        ,D D D D D Dr   