
    'YHhx	                         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y)z0assert functions from numpy and pandas testing

    )testingNBunch)paramsbsetvaluespvaluesc                 .      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        |   |i | t        |       st        dj	                              t              D ]  \  }}t        |       d d |f   | |<    y )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        R/var/www/html/planif/env/lib/python3.12/site-packages/statsmodels/tools/testing.pyr   z,bunch_factory.<locals>.FactoryBunch.__init__!   sn    Gd-f-4+$ &77=vi7HJ J#G, ;3#D)4QT:S	;    )__name__
__module____qualname__r   __classcell__)r   r   r   s   @r   FactoryBunchr       s    	; 	;r   r#   r   )r   r   r#   s   `` r   bunch_factoryr$      s    ";u ; r   params_tablemargins_tablec                   "    e Zd ZdZd Zd Zd Zy)HolderzF
    Test-focused class to simplify accessing values by attribute
    c                 :    | j                   j                  |       y )N)__dict__update)r   kwdss     r   r   zHolder.__init__5   s    T"r   c                 d    dj                  d t        |       j                         D              }|S )N
c              3   v   K   | ]1  \  }}t        |      d z   t        |      j                  dd      z    3 ywz = r.   z
    N)strreplace.0kvs      r   	<genexpr>z!Holder.__str__.<locals>.<genexpr>9   s8      71a 1v~AtX(FF 7   79)joinvarsitemsr   sss     r   __str__zHolder.__str__8   s/    YY 7#':#3#3#57 7	r   c                     dj                  d t        |       j                         D              }t        | j                        dz   |z   }|S )Nr.   c              3   v   K   | ]1  \  }}t        |      d z   t        |      j                  dd      z    3 ywr0   )r1   reprr2   r3   s      r   r7   z"Holder.__repr__.<locals>.<genexpr>?   s8      71a 1v~Qh(GG 7r8   )r9   r:   r;   r1   r   r<   s     r   __repr__zHolder.__repr__=   sG    YY 7#':#3#3#57 7 4'",	r   N)r   r    r!   __doc__r   r>   rB    r   r   r(   r(   1   s    #
r   r(   c                 `   t        |t        j                        rt        j                  | |       y t        |t        j
                        rt        j                  | |fi | y t        |t        j                        rt        j                  | |fi | y t        j                  | |dd       y )N T)err_msgverbose)
isinstancepandasIndexpdtassert_index_equalSeriesassert_series_equal	DataFrameassert_frame_equalnptassert_equal)actualdesiredrG   rH   r,   s        r   rS   rS   G   s|    '6<<(vw/	GV]]	+848	GV--	.vw7$7"dCr   )rF   T)rC   statsmodels.compat.pandasr   rL   numpy.testingrR   rJ   statsmodels.tools.toolsr   
PARAM_LISTr$   ParamsTableTestBunchMarginTableTestBunchr(   rS   rD   r   r   <module>r\      sP    5   ) 5
: %^Z@ $_jA  ,Dr   