o
    ga                     @  s  d dl mZ d dlZd dlmZmZmZmZ d dlZ	d dl
mZ d dlmZ d dlmZ d dlm  mZ d dlmZ d dlmZmZmZmZmZmZ d d	lmZmZm Z m!Z! d d
l"m#Z# d dl$Z%d dl$m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 d dl1m2Z2m3Z3m4Z4m5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z> erd dl?m@Z@ 			ddddZAdddZBddd#d$ZC		 	 	 	 			%ddd0d1ZD	2ddd3d4ZEddd7d8ZFdd9d:ZGdd;d<ZH	 	 	=ddd?d@ZI	AdddBdCZJdddEdFZK	 dddIdJZL	 dddLdMZM	dddOdPZN	Q	 			R	dddTdUZOd dejPejPejPdVfddYdZZQd dd d ejPdQd d d d ejPejPd[fd dQd\ddcddZRd ddd d dQejPdQd dQd d ejPejPdefddidjZSddkdlZTddmdnZUddodpZVddqdrZWddvdwZXdd|d}ZY	ddddZZdS )    )annotationsN)TYPE_CHECKINGLiteralNoReturncast)lib)is_matching_na)SparseIndex)compare_mismatched_resolutions)is_boolis_float_dtypeis_integer_dtype	is_numberis_numeric_dtypeneeds_i8_conversion)CategoricalDtypeDatetimeTZDtypeExtensionDtypeNumpyEADtype)array_equivalent)Categorical	DataFrameDatetimeIndexIndexIntervalDtypeIntervalIndex
MultiIndexPeriodIndex
RangeIndexSeriesTimedeltaIndex)DatetimeArrayExtensionArrayIntervalArrayPeriodArrayTimedeltaArray)DatetimeLikeArrayMixin)StringDtype)safe_sort_index)pprint_thing)DtypeObjequivh㈵>:0yE>check_dtypebool | Literal['equiv']rtolfloatatolreturnNonec                 K  s   t | trt| |fd|||d| dS t | tr*t| |fd|||d| dS t | tr?t| |fd|||d| dS |rkt| rJt|rJn!t| rSt|rSnt | t	j
s_t |t	j
rbd}nd}t| ||d tj| |ft|||d| dS )	a  
    Check that the left and right objects are approximately equal.

    By approximately equal, we refer to objects that are numbers or that
    contain numbers which may be equivalent to specific levels of precision.

    Parameters
    ----------
    left : object
    right : object
    check_dtype : bool or {'equiv'}, default 'equiv'
        Check dtype if both a and b are the same type. If 'equiv' is passed in,
        then `RangeIndex` and `Index` with int64 dtype are also considered
        equivalent when doing type checking.
    rtol : float, default 1e-5
        Relative tolerance.
    atol : float, default 1e-8
        Absolute tolerance.
    F)check_exactexactr0   r2   )r5   r.   r0   r2   numpy arrayInputobj)r.   r0   r2   N)
isinstancer   assert_index_equalr   assert_series_equalr   assert_frame_equalr   r   npndarrayassert_class_equal_testingassert_almost_equalbool)leftrightr.   r0   r2   kwargsr:    rH   [/var/www/html/ecg_monitoring/venv/lib/python3.10/site-packages/pandas/_testing/asserters.pyrC   B   sh   









rC   c                 C  sZ   |j }t| |st| d| dt|  dt||s+t| d| dt| ddS )a  
    Helper method for our assert_* methods that ensures that
    the two objects being compared have the right type before
    proceeding with the comparison.

    Parameters
    ----------
    left : The first object being compared.
    right : The second object being compared.
    cls : The class type to check against.

    Raises
    ------
    AssertionError : Either `left` or `right` is not an instance of `cls`.
    z Expected type z, found z insteadN)__name__r;   AssertionErrortype)rE   rF   clscls_namerH   rH   rI   _check_isinstance   s   

rO   Tcompare_keysrD   c                 C  s    t | |t tj| ||d d S )N)rP   )rO   dictrB   assert_dict_equal)rE   rF   rP   rH   rH   rI   rR      s   rR   r   rE   rF   r6   
bool | strcheck_namesr5   check_categoricalcheck_orderr:   strc
                   s  d}
dd fdd}t | |t || ||	d	 | j|jkr:|	 d
}| j d|  }|j d| }t|	||| t| t|kr`|	 d}t|  d|  }t| d| }t|	||| |sjt| } t|}t| trtt|}t	| jD ]V}d| d}z t
| j| |j| || |||d	 t| j| |j|  W n  ty   | |}||}t
|||| |||d	 Y nw || j| |j| |	d	 qynU|r r| |s| j|jk}t|tjstd|d}t|td t|  }|	 dt|d d}t|	|| | nt}tj| j|j||||	| |d |r1td| ||	d	 t| ts=t|trEtd| ||	d	 t| tsQt|trXt | j|j  rwt| j!t"sit|j!t"ryt#| j|j|	 dd	 dS dS dS )ak  
    Check that left and right Index are equal.

    Parameters
    ----------
    left : Index
    right : Index
    exact : bool or {'equiv'}, default 'equiv'
        Whether to check the Index class, dtype and inferred_type
        are identical. If 'equiv', then RangeIndex can be substituted for
        Index with an int64 dtype as well.
    check_names : bool, default True
        Whether to check the names attribute.
    check_exact : bool, default True
        Whether to compare number exactly.
    check_categorical : bool, default True
        Whether to compare internal Categorical exactly.
    check_order : bool, default True
        Whether to compare the order of index entries as well as their values.
        If True, both indexes must contain the same elements, in the same order.
        If False, both indexes must contain the same elements, but in any order.
    rtol : float, default 1e-5
        Relative tolerance. Only used when check_exact is False.
    atol : float, default 1e-8
        Absolute tolerance. Only used when check_exact is False.
    obj : str, default 'Index'
        Specify object name being compared, internally used to show appropriate
        assertion message.

    Examples
    --------
    >>> from pandas import testing as tm
    >>> a = pd.Index([1, 2, 3])
    >>> b = pd.Index([1, 2, 3])
    >>> tm.assert_index_equal(a, b)
    Tr   r:   rW   r3   r4   c                   s~   sd S t | ||d td| ||d t| jtr5t|jtr5 r3td| ||d t| j|jd d S td| ||d d S )N)r6   r:   inferred_typer9   dtype)r6   )rA   assert_attr_equalr;   rY   r   r<   
categoriesrE   rF   r:   rU   r6   rH   rI   _check_types   s   z(assert_index_equal.<locals>._check_typesr9   z levels are different, z length are differentzMultiIndex level [])r6   rT   r5   rU   r0   r2   r:   r"         Y@ values are different (    %))r0   r2   r.   r:   lobjrobjnamesrY   	 categoryN)r   r:   rW   r3   r4   )$rO   r   nlevelsraise_assert_detaillenr(   r;   r   r   ranger<   levelsassert_numpy_array_equalcodesrK   get_level_valuesequals_valuesr?   r@   fillnasumastypeintroundrD   rB   rC   valuesrZ   r   r   assert_interval_array_equalrY   r   assert_categorical_equal)rE   rF   r6   rT   r5   rU   rV   r0   r2   r:   __tracebackhide__r^   msg1msg2msg3levelre   llevelrlevelmismatchdiffmsg
exact_boolrH   r]   rI   r<      s   0






#r<   r8   c                 C  sj   d}dd }ddd	}t | t |krd
S |dkr#|| r#||r#d
S | d}t|||| || d
S )z#
    Checks classes are equal.
    Tc                 S  s   t | tr| S t| jS N)r;   r   rL   rJ   )xrH   rH   rI   
repr_classh  s   

z&assert_class_equal.<locals>.repr_classidxr   r3   rD   c                 S  s   t | tu p
t| tS )zClasses that are a RangeIndex (sub-)instance or exactly an `Index` .

        This only checks class equivalence. There is a separate check that the
        dtype is int64.
        )rL   r   r;   r   )r   rH   rH   rI   is_class_equivo  s   z*assert_class_equal.<locals>.is_class_equivNr+   z classes are different)r   r   r3   rD   )rL   rk   )rE   rF   r6   r:   r|   r   r   r   rH   rH   rI   rA   `  s   

rA   
Attributesattrc           	      C  s   d}t || }t || }||u st||rdS z||k}W n ty(   d}Y nw |tju |tju A r6d}n	t|ts?| }|sNd|  d}t|||| dS )aO  
    Check attributes are equal. Both objects must have attribute.

    Parameters
    ----------
    attr : str
        Attribute name being compared.
    left : object
    right : object
    obj : str, default 'Attributes'
        Specify object name being compared, internally used to show appropriate
        assertion message
    TNFzAttribute "z" are different)	getattrr   	TypeErrorpdNAr;   rD   allrk   )	r   rE   rF   r:   r|   	left_attr
right_attrresultr   rH   rH   rI   rZ     s$   


rZ   c                 C  s   ddl m} ddlm} t| ttjfr:t| tr| j} | 	 D ]}dt
t|j }t||tfs7J |q d S dt
t| j }t| |ttfsPJ |d S )Nr   )Artist)AxeszBone of 'objs' is not a matplotlib Axes instance, type encountered zoobjs is neither an ndarray of Artist instances nor a single ArtistArtist instance, tuple, or dict, 'objs' is a )matplotlib.artistr   matplotlib.axesr   r;   r   r?   r@   rs   ravelreprrL   rJ   rQ   tuple)objsr   r   elr   rH   rH   rI   "assert_is_valid_plot_return_object  s"   
r   c                 C  sP   t | ttfr
| j} t | tjrt| tt|  dS t	| | | 
   dS )z#Assert that the sequence is sorted.N)r;   r   r   ry   r?   r@   ro   sortarrayassert_extension_array_equalargsort)seqrH   rH   rI   assert_is_sorted  s
   r   r   check_category_orderc                 C  s   t | |t t| jtst|jtrd}nd}|r4t| j|j| d|d t| j|j|| dd n=z| j }|j }W n t	yP   | j|j}}Y nw t||| d|d t| j
| j|j
|j| d|d td| ||d	 d
S )a}  
    Test that Categoricals are equivalent.

    Parameters
    ----------
    left : Categorical
    right : Categorical
    check_dtype : bool, default True
        Check that integer dtype of the codes are the same.
    check_category_order : bool, default True
        Whether the order of the categories should be compared, which
        implies identical integer codes.  If False, only the resulting
        values are compared.  The ordered attribute is
        checked regardless.
    obj : str, default 'Categorical'
        Specify object name being compared, internally used to show appropriate
        assertion message.
    r+   Tz.categories)r:   r6   z.codesr.   r:   z.valuesorderedr9   N)rO   r   r;   r[   r   r<   ro   rp   sort_valuesr   takerZ   )rE   rF   r.   r   r:   r6   lcrcrH   rH   rI   r{     s6   
r{   r#   c                 C  sz   t | |t i }| jjjdv rd|d< t| j|jfd| di| t| j|jfd| di| td| ||d dS )	a  
    Test that two IntervalArrays are equivalent.

    Parameters
    ----------
    left, right : IntervalArray
        The IntervalArrays to compare.
    exact : bool or {'equiv'}, default 'equiv'
        Whether to check the Index class, dtype and inferred_type
        are identical. If 'equiv', then RangeIndex can be substituted for
        Index with an int64 dtype as well.
    obj : str, default 'IntervalArray'
        Specify object name being compared, internally used to show appropriate
        assertion message
    mMF
check_freqr:   z.leftclosedr9   N)rO   r#   _leftrY   kindassert_equal_rightrZ   )rE   rF   r6   r:   rG   rH   rH   rI   rz     s     rz   r$   c                 C  s8   t | |t t| j|j| dd td| ||d d S )N	._ndarrayr9   rY   )rO   r$   ro   _ndarrayrZ   r\   rH   rH   rI   assert_period_array_equal&  s   r   r!   r   c                 C  sP   d}t | |t t| j|j| dd |rtd| ||d td| ||d d S )NTr   r9   freqtz)rO   r!   ro   r   rZ   rE   rF   r:   r   r|   rH   rH   rI   assert_datetime_array_equal-  s   r   r%   c                 C  sD   d}t | |t t| j|j| dd |r td| ||d d S d S )NTr   r9   r   )rO   r%   ro   r   rZ   r   rH   rH   rI   assert_timedelta_array_equal9  s   r   r   c           	      C  s   d}|  d| }t |trt|}t |tjr"|dt| 7 }t |tjr-t|}nt |tttfr9t	|}t |tjrDt|}nt |tttfrPt	|}|d| d| 7 }|d ure|d| 7 }|d urp|d| 7 }t
|)NTz are different

z

[index]: z

[left]:  z

[right]: z	
[diff]: 
)r;   r   r?   asarrayr@   r)   r   r   r'   r   rK   )	r:   messagerE   rF   r   
first_diffindex_valuesr|   r   rH   rH   rI   rk   C  s4   



rk   Fr7   
strict_nanc                   s   d}t | |d t| |tj dd }	|	| }
|	|}|dkr2|
|ur1tt|
 dt| n|dkrG|
|u rGtt|
 dt| d fdd}t| |ds]|| || |rut| tjrwt|tjrytd| |d dS dS dS dS )a3  
    Check that 'np.ndarray' is equivalent.

    Parameters
    ----------
    left, right : numpy.ndarray or iterable
        The two arrays to be compared.
    strict_nan : bool, default False
        If True, consider NaN and None to be different.
    check_dtype : bool, default True
        Check dtype if both a and b are np.ndarray.
    err_msg : str, default None
        If provided, used as assertion message.
    check_same : None|'copy'|'same', default None
        Ensure left and right refer/do not refer to the same memory area.
    obj : str, default 'numpy array'
        Specify object name being compared, internally used to show appropriate
        assertion message.
    index_values : Index | numpy.ndarray, default None
        optional index (shared by both left and right), used in output.
    Tr9   c                 S  s   t | dd d ur| jS | S )Nbase)r   r   r9   rH   rH   rI   	_get_base  s   z+assert_numpy_array_equal.<locals>._get_basesamez is not copyz is r3   r   c                   s   |d u rI| j |j krt d| j |j  d}t| |D ]\}}t||ds,|d7 }q|d | j } dt|d d}t|| | d	 t|)
Nz shapes are differentr   r      ra   rb   rc   rd   )r   )shaperk   zipr   sizer?   rx   rK   )rE   rF   err_msgr   left_arr	right_arrr   r   r:   r   rH   rI   _raise  s   z(assert_numpy_array_equal.<locals>._raiser   rY   Nr3   r   )	rA   rO   r?   r@   rK   r   r   r;   rZ   )rE   rF   r   r.   r   
check_samer:   r   r|   r   	left_base
right_baser   rH   r   rI   ro   i  s*   ro   r"   bool | lib.NoDefaultfloat | lib.NoDefaultc              	   C  s"  |t ju r&|t ju r&|t ju r&t| jrt| j p$t|jo$t|j }n|t ju r-d}|t jur4|nd}|t jur=|nd}t| tsHJ dt|tsQJ d|r^td| |d| d t| trt|trt	|t	| kr|s| jj
d	v rt| jtjstt| jj}nt| jd
 }t|jtjstt|jj}	nt|jd
 }	||	krt| j|jtj rdS tt| jt|j||d dS t|  }
t| }t|
|| d|d | |
  jtd}||  jtd}|rt||||d dS tj||t|||||d dS )a  
    Check that left and right ExtensionArrays are equal.

    Parameters
    ----------
    left, right : ExtensionArray
        The two arrays to compare.
    check_dtype : bool, default True
        Whether to check if the ExtensionArray dtypes are identical.
    index_values : Index | numpy.ndarray, default None
        Optional index (shared by both left and right), used in output.
    check_exact : bool, default False
        Whether to compare number exactly.

        .. versionchanged:: 2.2.0

            Defaults to True for integer dtypes if none of
            ``check_exact``, ``rtol`` and ``atol`` are specified.
    rtol : float, default 1e-5
        Relative tolerance. Only used when check_exact is False.
    atol : float, default 1e-8
        Absolute tolerance. Only used when check_exact is False.
    obj : str, default 'ExtensionArray'
        Specify object name being compared, internally used to show appropriate
        assertion message.

        .. versionadded:: 2.0.0

    Notes
    -----
    Missing values are checked separately from valid values.
    A mask of missing values is computed for each and checked to match.
    The remaining all-valid values are cast to object dtype and checked.

    Examples
    --------
    >>> from pandas import testing as tm
    >>> a = pd.Series([1, 2, 3, 4])
    >>> b, c = a.array, a.array
    >>> tm.assert_extension_array_equal(b, c)
    Fr,   r-   zleft is not an ExtensionArrayzright is not an ExtensionArrayrY   Attributes of r9   r   r   N)r   r:   z NA mask)r:   r   )rY   )r.   r0   r2   r:   r   )r   
no_defaultr   rY   r   r;   r"   rZ   r&   rL   r   r?   r   r   unitdatetime_datar
   r   operatoreqr   ro   r   asi8isnato_numpyobjectrB   rC   rD   )rE   rF   r.   r   r5   r0   r2   r:   l_unitr_unitleft_naright_na
left_validright_validrH   rH   rI   r     s~   
4










r   r   )check_index
check_likecheck_index_typecheck_series_typecheck_datetimelike_compatcheck_flagsr   r   c                C  sp  d}|t ju r	dn|}|t ju r1|t ju r1|t ju r1t| jr%t| j p/t|jo/t|j }n|t ju r8d}|t jur?|nd}|t jurH|nd}|sR|rRtdt| |t |rat| ||d t	| t	|krt	|  d| j
 }t	| d|j
 }t|d|| |r| j|jksJ t| j d	t|j |rt| j
|j
||||| ||| d
d
 |r| |} |
rt| j
ttfr| j
}|j
}|j|jksJ |j|jf|rt| jtrt|jtr|sntd| |d| d |r:| j}|j}t|trt|trt|||| j
t|d n||}}t|tr#| }t|tr-| }t|||t|| j
d n|ret| jsIt|jret| jt|jsdd| j d|j d}t|nt| jt r{t|jt r{t!| j"|j" nt| jtst|jtrt#j$| j|j||t%|t|| j
d nlt| jt&rt|jt&rt| j|j|||| j
t|d nMt'| j|jst'|j| jrt| j|j|| j
t|d n.t| jrt|jrt| j|j|| j
t|d nt#j$| j|j||t%|t|| j
d |rtd| ||d |r4t| jts%t|jtr6t(| j|j| d|	d dS dS dS )a  
    Check that left and right Series are equal.

    Parameters
    ----------
    left : Series
    right : Series
    check_dtype : bool, default True
        Whether to check the Series dtype is identical.
    check_index_type : bool or {'equiv'}, default 'equiv'
        Whether to check the Index class, dtype and inferred_type
        are identical.
    check_series_type : bool, default True
         Whether to check the Series class is identical.
    check_names : bool, default True
        Whether to check the Series and Index names attribute.
    check_exact : bool, default False
        Whether to compare number exactly.

        .. versionchanged:: 2.2.0

            Defaults to True for integer dtypes if none of
            ``check_exact``, ``rtol`` and ``atol`` are specified.
    check_datetimelike_compat : bool, default False
        Compare datetime-like which is comparable ignoring dtype.
    check_categorical : bool, default True
        Whether to compare internal Categorical exactly.
    check_category_order : bool, default True
        Whether to compare category order of internal Categoricals.
    check_freq : bool, default True
        Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
    check_flags : bool, default True
        Whether to check the `flags` attribute.
    rtol : float, default 1e-5
        Relative tolerance. Only used when check_exact is False.
    atol : float, default 1e-8
        Absolute tolerance. Only used when check_exact is False.
    obj : str, default 'Series'
        Specify object name being compared, internally used to show appropriate
        assertion message.
    check_index : bool, default True
        Whether to check index equivalence. If False, then compare only values.

        .. versionadded:: 1.3.0
    check_like : bool, default False
        If True, ignore the order of the index. Must be False if check_index is False.
        Note: same labels must be with the same data.

        .. versionadded:: 1.5.0

    Examples
    --------
    >>> from pandas import testing as tm
    >>> a = pd.Series([1, 2, 3, 4])
    >>> b = pd.Series([1, 2, 3, 4])
    >>> tm.assert_series_equal(a, b)
    TFr,   r-   z0check_like must be False if check_index is Falser9   r_   zSeries length are different != .indexr6   rT   r5   rU   rV   r0   r2   r:   rY   r   )r.   r   r:   )r.   r:   r   z[datetimelike_compat=True] z is not equal to .)r0   r2   r.   r:   r   )r0   r2   r.   r   r:   namerh   )r:   r   N))r   r   r   rY   r   
ValueErrorrO   r   rA   rl   indexrk   flagsr   r<   reindex_liker;   r   r    r   r   rZ   rs   r"   r   rW   r   ro   r   r   rr   rK   r   rz   r   rB   rC   rD   r   0is_extension_array_dtype_and_needs_i8_conversionr{   )rE   rF   r.   r   r   rT   r5   r   rU   r   r   r   r0   r2   r:   r   r   r|   check_exact_indexr}   r~   lidxridxleft_valuesright_valueslvrvr   rH   rH   rI   r=   ;  sD  M







*



		
		
r=   r   check_column_typecheck_frame_type	by_blocksc                 C  s  d}|t jur	|nd}|t jur|nd}|t jur|nd}t| |t |r.t| t|s.J | j|jkrFt|| dt| j t|j  |r]| j	|j	ks]J t| j	 dt|j	 t
| j|j||||
| ||| dd
 t
| j|j||||
| ||| d	d
 |r| |} |r| }|  }ttt| t|  D ]}||v sJ ||v sJ t|| || ||d
 qdS t| jD ]-\}}| j|dd}|j|dd}t|||||||	|
|| d| d| d||ddd qdS )a  
    Check that left and right DataFrame are equal.

    This function is intended to compare two DataFrames and output any
    differences. It is mostly intended for use in unit tests.
    Additional parameters allow varying the strictness of the
    equality checks performed.

    Parameters
    ----------
    left : DataFrame
        First DataFrame to compare.
    right : DataFrame
        Second DataFrame to compare.
    check_dtype : bool, default True
        Whether to check the DataFrame dtype is identical.
    check_index_type : bool or {'equiv'}, default 'equiv'
        Whether to check the Index class, dtype and inferred_type
        are identical.
    check_column_type : bool or {'equiv'}, default 'equiv'
        Whether to check the columns class, dtype and inferred_type
        are identical. Is passed as the ``exact`` argument of
        :func:`assert_index_equal`.
    check_frame_type : bool, default True
        Whether to check the DataFrame class is identical.
    check_names : bool, default True
        Whether to check that the `names` attribute for both the `index`
        and `column` attributes of the DataFrame is identical.
    by_blocks : bool, default False
        Specify how to compare internal data. If False, compare by columns.
        If True, compare by blocks.
    check_exact : bool, default False
        Whether to compare number exactly.

        .. versionchanged:: 2.2.0

            Defaults to True for integer dtypes if none of
            ``check_exact``, ``rtol`` and ``atol`` are specified.
    check_datetimelike_compat : bool, default False
        Compare datetime-like which is comparable ignoring dtype.
    check_categorical : bool, default True
        Whether to compare internal Categorical exactly.
    check_like : bool, default False
        If True, ignore the order of index & columns.
        Note: index labels must match their respective rows
        (same as in columns) - same labels must be with the same data.
    check_freq : bool, default True
        Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
    check_flags : bool, default True
        Whether to check the `flags` attribute.
    rtol : float, default 1e-5
        Relative tolerance. Only used when check_exact is False.
    atol : float, default 1e-8
        Absolute tolerance. Only used when check_exact is False.
    obj : str, default 'DataFrame'
        Specify object name being compared, internally used to show appropriate
        assertion message.

    See Also
    --------
    assert_series_equal : Equivalent method for asserting Series equality.
    DataFrame.equals : Check DataFrame equality.

    Examples
    --------
    This example shows comparing two DataFrames that are equal
    but with columns of differing dtypes.

    >>> from pandas.testing import assert_frame_equal
    >>> df1 = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
    >>> df2 = pd.DataFrame({'a': [1, 2], 'b': [3.0, 4.0]})

    df1 equals itself.

    >>> assert_frame_equal(df1, df1)

    df1 differs from df2 as column 'b' is of a different type.

    >>> assert_frame_equal(df1, df2)
    Traceback (most recent call last):
    ...
    AssertionError: Attributes of DataFrame.iloc[:, 1] (column name="b") are different

    Attribute "dtype" are different
    [left]:  int64
    [right]: float64

    Ignore differing dtypes in columns with check_dtype.

    >>> assert_frame_equal(df1, df2, check_dtype=False)
    Tr,   r-   Fz shape mismatchr   r   r   z.columnsr   r   )axisz	.iloc[:, z] (column name="z"))r.   r   r5   rT   r   rU   r   r:   r0   r2   r   r   N)r   r   rO   r   r;   rL   r   rk   r   r   r<   r   columnsr   _to_dict_of_blockslistsetkeysr>   	enumerate_ixsr=   )rE   rF   r.   r   r   r   rT   r   r5   r   rU   r   r   r   r0   r2   r:   r|   _rtol_atol_check_exactrblockslblocksrY   icollcolrcolrH   rH   rI   r>   F  s   n*
$	r>   c                 K  s  d}t | tr)t| |fi | t | ttfr%| j|jks'J | j|jfdS dS t | tr9t| |fi | dS t | trIt	| |fi | dS t | t
rYt| |fi | dS t | trit| |fi | dS t | tryt| |fi | dS t | trt| |fi | dS t | trt| |fi | dS t | tjrt| |fi | dS t | tr|i ksJ | |ksJ dS |i ksJ t| | dS )aC  
    Wrapper for tm.assert_*_equal to dispatch to the appropriate test function.

    Parameters
    ----------
    left, right : Index, Series, DataFrame, ExtensionArray, or np.ndarray
        The two items to be compared.
    **kwargs
        All keyword arguments are passed through to the underlying assert method.
    TN)r;   r   r<   r   r    r   r   r=   r   r>   r#   rz   r$   r   r!   r   r%   r   r"   r   r?   r@   ro   rW   rC   )rE   rF   rG   r|   rH   rH   rI   r     s8   








r   c                 C  s   t | |tjj t| j|j t| jtsJ t|jtsJ | j}|j}|	|s2t
dd|| n	 td| | td| | t|  |  dS )z
    Check that the left and right SparseArray are equal.

    Parameters
    ----------
    left : SparseArray
    right : SparseArray
    zSparseArray.indexzindex are not equal
fill_valuerY   N)rO   r   arraysSparseArrayro   	sp_valuesr;   sp_indexr	   rr   rk   rZ   to_dense)rE   rF   
left_indexright_indexrH   rH   rI   assert_sp_array_equal:  s   	
r  c                 C  s(   | D ]}||v sJ dt | qd S )NzDid not contain item: )r   )iterabledickrH   rH   rI   assert_contains_all[  s   r  c                 K  s\   t | |D ]&\}}t||fi | dtt| dtt| d}||us+J |qdS )z
    iter1, iter2: iterables that produce elements
    comparable with assert_almost_equal

    Checks that the elements are equal, but not
    the same object. (Does not check that items
    in sequences are also not the same object)
    zExpected object z and object z8 to be different objects, but they were the same object.N)r   rC   r   rL   )iter1iter2
eql_kwargselem1elem2r   rH   rH   rI   assert_copy`  s   	 r#  
left_dtyper*   right_dtypec                 C  s   t | tot|S )z
    Checks that we have the combination of an ExtensionArraydtype and
    a dtype that should be converted to int64

    Returns
    -------
    bool

    Related to issue #37609
    )r;   r   r   )r$  r%  rH   rH   rI   r   r  s   r   serl_slcslicei_slcc                 C  s:   | j | }t| j| | t| jst| | | dS dS )z_
    Check that ser.iloc[i_slc] matches ser.loc[l_slc] and, if applicable,
    ser[l_slc].
    N)ilocr=   locr   r   )r&  r'  r)  expectedrH   rH   rI   !assert_indexing_slices_equivalent  s
   

r-  DataFrame | SeriesDataFrame | Series | Nonec                 C  sF   | j D ]}t| |d}|du r|du sJ q|t||dks J qdS )z:
    Check that ._metadata attributes are equivalent.
    N)	_metadatar   )rE   rF   r   valrH   rH   rI   assert_metadata_equivalent  s   
r2  )r+   r,   r-   )r.   r/   r0   r1   r2   r1   r3   r4   )r3   r4   )T)rP   rD   r3   r4   )r+   TTTTr,   r-   r   )rE   r   rF   r   r6   rS   rT   rD   r5   rD   rU   rD   rV   rD   r0   r1   r2   r1   r:   rW   r3   r4   )Tr8   )r6   rS   r:   rW   r3   r4   )r   )r   rW   r:   rW   r3   r4   )TTr   )r.   rD   r   rD   r:   rW   r3   r4   )r+   r#   )r6   r/   r:   rW   r3   r4   )r$   ri   )r!   T)r:   rW   r   rD   r3   r4   )r%   T)NNNr   )FTNNr7   N)r   rD   r.   r/   r:   rW   r3   r4   )r.   r/   r5   r   r0   r   r2   r   r:   rW   r3   r4   ) r.   r/   r   r/   r   rD   rT   rD   r5   r   r   rD   rU   rD   r   rD   r   rD   r   rD   r0   r   r2   r   r:   rW   r   rD   r   rD   r3   r4   ) r.   r/   r   r/   r   r/   r   rD   rT   rD   r   rD   r5   r   r   rD   rU   rD   r   rD   r   rD   r   rD   r0   r   r2   r   r:   rW   r3   r4   )r$  r*   r%  r*   r3   rD   )r&  r   r'  r(  r)  r(  r3   r4   r   )rE   r.  rF   r/  r3   r4   )[
__future__r   r   typingr   r   r   r   numpyr?   pandas._libsr   pandas._libs.missingr   pandas._libs.sparser	   pandas._libs.testing_libstestingrB   pandas._libs.tslibs.np_datetimer
   pandas.core.dtypes.commonr   r   r   r   r   r   pandas.core.dtypes.dtypesr   r   r   r   pandas.core.dtypes.missingr   pandasr   r   r   r   r   r   r   r   r   r   r   r    pandas.core.arraysr!   r"   r#   r$   r%   pandas.core.arrays.datetimeliker&   pandas.core.arrays.string_r'   pandas.core.indexes.apir(   pandas.io.formats.printingr)   pandas._typingr*   rC   rO   rR   r<   rA   rZ   r   r   r{   rz   r   r   r   rk   ro   r   r   r=   r>   r   r  r  r#  r   r-  r2  rH   rH   rH   rI   <module>   s     4
R -"
'
>)S    
L
)
!


