
    i>                     >	   d dl Zd dlZd dlZd dlmZmZmZ d dlm	Z
 d Zd Zd Zej                  j                  d ed       ed       ed	      g      d
        Zej                  j                  d ed       edd      f ed       ed      f ed	       ed      f ed	       ed      f ed       ed      fg      d        Zej                  j                  dddidg diddig      d        Zej                  j                  dddg      ej                  j                  dg d      d               Zej                  j                  d ed d!gdd"g#       ed d!gd$d%g#      d&f ej,                  dd"gd'd(gd d!gd)d*d+g#      j.                   ej,                  d$d%gd'd(gd d!gd)d*d+g#      j.                  d,fg      d-        Zej                  j                  d.d/d0g      d1        Zej                  j                  d2d/d0g      d3        Zd4 Zd5 Zd6 Zd7 Zd8 Zd9 Z d: Z!d; Z"d< Z#d= Z$d> Z%d? Z&d@ Z'dA Z(dB Z)ej                  j                  ddCdDg      dE        Z*ej                  j                  ddFdGg      dH        Z+ej                  j                  dde,g      ej                  j                  dId/d0g      ej                  j                  dJddKg      dL                      Z-dM Z.ej                  j                  dN ej^                  g dO       ej^                   ej`                  d ddP            fejb                  je                  g dQg dOg      ejb                  je                  g dQ ej`                  d ddP      g      fejb                  je                  g dRg dSg      ejb                  je                  g dRg dTg      f ejf                   ej^                  g dS       ej^                  g dT      ej                  ji                  dUV      W       ejf                  ejb                  je                  g dQg dSg      ejb                  je                  g dQg dTg      ej                  ji                  dUV      W      g      dX        Z5y)Y    N)Categorical	DataFrameSeriesc                 `    t        j                  | |fi | t        j                  || fi | y)a&  
    Check that two Series equal.

    This check is performed commutatively.

    Parameters
    ----------
    a : Series
        The first Series to compare.
    b : Series
        The second Series to compare.
    kwargs : dict
        The arguments passed to `tm.assert_series_equal`.
    N)tmassert_series_equalabkwargss      g/app/cer_product_mecsu/.venv/lib/python3.12/site-packages/pandas/tests/util/test_assert_series_equal.py_assert_series_equal_bothr      s.     1a*6*1a*6*    c                     	 t        j                  | |fi | d}t        j                  |       y# t        $ r Y yw xY w)a  
    Check that two Series are not equal.

    Parameters
    ----------
    a : Series
        The first Series to compare.
    b : Series
        The second Series to compare.
    kwargs : dict
        The arguments passed to `tm.assert_series_equal`.
    z7The two Series were equal when they shouldn't have been)msgN)r   r   pytestfailAssertionError)r
   r   r   r   s       r   _assert_not_series_equalr       s?    
q!.v.G s   /2 	>>c                 8    t        | |fi | t        || fi | y)a.  
    Check that two Series are not equal.

    This check is performed commutatively.

    Parameters
    ----------
    a : Series
        The first Series to compare.
    b : Series
        The second Series to compare.
    kwargs : dict
        The arguments passed to `tm.assert_series_equal`.
    N)r   r	   s      r   _assert_not_series_equal_bothr   6   s"     Q,V,Q,V,r   data   abcu   áàäc                 @    t        t        |       t        |              y N)r   r   )r   s    r   test_series_equalr   I   s    fTlF4L9r   zdata1,data2      xyzu   éèës   aaac                 @    t        t        |       t        |             y r   )r   r   )data1data2s     r   $test_series_not_equal_value_mismatchr$   N   s     "&-?r   r   dtypefloat64indexr      r   namefooc                 `    t        d      }t        |      }t        |fi | }t        ||       y )Nr   )ranger   r   )r   r   s1s2s       r   'test_series_not_equal_metadata_mismatchr0   \   s/     8D	B			B!"b)r   )g|Pk?g9]?)gV-?g??decimals)r   r   r)   r      
   c                 .   d| z  }t        | g|      }t        |g|      }|dv s|dk\  rPt        | |z
        dk\  r?d}t        j                  t        |      5  t        j                  |||       d d d        y t        |||       y # 1 sw Y   y xY w)	Nr3   r%   )r2   r3   r   gMb@?zSeries values are differentmatchrtol)r   absr   raisesr   r   r   r   )r"   r#   any_float_dtyper1   r9   r.   r/   r   s           r   test_less_preciser=   l   s     y=D		/B		/B7x1}UU]1Cv1M+]]>5 	6""2r5	6 	6 	""bt4	6 	6s   BBz	s1,s2,msgl1l2r)   r'   g      ?g       @zSeries\.index are differentg @      ?r
   r   cr
   r   z'Series\.index level \[0\] are differentc                     d|i}|r<t        j                  t        |      5  t        j                  | |fi | d d d        y t        j                  | |fi | y # 1 sw Y   y xY w)Ncheck_index_typer6   )r   r;   r   r   r   )r.   r/   r   rE   r   s        r   test_series_equal_index_dtyperF   {   sf    , !"23F]]>5 	5""2r4V4	5 	5 	r200	5 	5s   AA$
check_likeTFc                     t        g dg d      }t        g dg d      }| s=t        j                  t        d      5  t	        j
                  |||        d d d        y t        |||        y # 1 sw Y   y xY w)	Nr   r)   r   rB   r@   )r   r)   r   rC   r   r
   Series.index are differentr6   )rG   r   r   r;   r   r   r   r   )rG   r.   r/   s      r    test_series_equal_order_mismatchrM      sk    			1B			1B]]>1MN 	B""2rjA	B 	B 	""bZ@	B 	B    A11A:check_indexc                     t        g dg d      }t        g dg d      }| r=t        j                  t        d      5  t	        j
                  |||        d d d        y t        |||        y # 1 sw Y   y xY w)NrI   rB   r@   rJ   rK   r6   )rO   rL   )rO   r.   r/   s      r    test_series_equal_index_mismatchrQ      sk    			1B			1B]]>1MN 	D""2r{C	D 	D 	""bkB	D 	DrN   c                      t        t              } t        t              }t        j                  t        d      5  t        j                  | |dd       d d d        y # 1 sw Y   y xY w)Nr5   z0check_like must be False if check_index is Falser6   FT)rO   rG   )r   objectr   r;   
ValueErrorr   r   leftrights     r   %test_series_invalid_param_combinationrX      sW    D E	L
 P 	tU$OP P Ps   AA(c                     d}t        g d      }t        g d      }t        j                  t        |      5  t	        j
                  |||        d d d        y # 1 sw Y   y xY w)NzSeries are different

Series length are different
\[left\]:  3, RangeIndex\(start=0, stop=3, step=1\)
\[right\]: 4, RangeIndex\(start=0, stop=4, step=1\)rI   )r   r)   r   r   r6   r8   r   r   r;   r   r   r   r9   r   r.   r/   s       r   !test_series_equal_length_mismatchr\      sT    ;C 
		B		B	~S	1 2
r2D12 2 2   AA#c                     d}t        g d      }t        g d      }t        j                  t        |      5  t	        j
                  |||        d d d        y # 1 sw Y   y xY w)NzSeries are different

Series values are different \(33\.33333 %\)
\[index\]: \[0, 1, 2\]
\[left\]:  \[1, 2, 3\]
\[right\]: \[1, 2, 4\]rI   r(   r6   r8   rZ   r[   s       r   )test_series_equal_numeric_values_mismatchr_      sT    C 
		B			B	~S	1 2
r2D12 2 2r]   c                 
   |rdnd}d| d| d}t        t        g d            }t        t        g d            }t        j                  t        |      5  t        j                  ||| 	       d d d        y # 1 sw Y   y xY w)
NstrrS   zSeries are different

Series values are different \(66\.66667 %\)
\[index\]: \[0, 1, 2\]
\[left\]:  \['a', 'b', 'c'\]
Categories \(3, zC\): \['a', 'b', 'c'\]
\[right\]: \['a', 'c', 'b'\]
Categories \(3, z\): \['a', 'b', 'c'\]rB   )r
   rC   r   r6   r8   )r   r   r   r;   r   r   r   )r9   using_infer_stringr%   r   r.   r/   s         r   -test_series_equal_categorical_values_mismatchrc      s    'EXE
  04C 
O,	-B	O,	-B	~S	1 2
r2D12 2 2s   A99Bc                     d}t        t        j                  dddd            }t        t        j                  dddd            }t        j                  t
        |      5  t        j                  ||| 	       d d d        y # 1 sw Y   y xY w)
NzSeries are different

Series values are different \(100.0 %\)
\[index\]: \[0, 1, 2\]
\[left\]:  \[1514764800000000000, 1514851200000000000, 1514937600000000000\]
\[right\]: \[1549065600000000000, 1549152000000000000, 1549238400000000000\]z
2018-01-01r   Dns)periodsfrequnitz
2019-02-02r6   r8   )r   pd
date_ranger   r;   r   r   r   r[   s       r   *test_series_equal_datetime_values_mismatchrl      ss    TC 
lACdK	LB	lACdK	LB	~S	1 2
r2D12 2 2s   "BBc                 D   |rd}nd}d| d| d}t        t        ddg            }t        t        ddgt        d      	            }| r=t        j                  t
        |
      5  t        j                  |||        d d d        y t        |||        y # 1 sw Y   y xY w)Nra   rS   zAttributes of Series are different

Attribute "dtype" are different
\[left\]:  CategoricalDtype\(categories=\['a', 'b'\], ordered=False, categories_dtype=z^\)
\[right\]: CategoricalDtype\(categories=\['a', 'b', 'c'\], ordered=False, categories_dtype=z\)r
   r   r   )
categoriesr6   )check_categorical)	r   r   listr   r;   r   r   r   r   )ro   rb   r%   r   r.   r/   s         r   &test_series_equal_categorical_mismatchrq      s      !!&s.C 
S#J'	(B	S#J4;?	@B]]>5 	P""2r=NO	P 	P 	""b<MN	P 	Ps   %BBc                  6   t        t        j                  g dd            } | j                  t              }d}t        j                  | |d       t        j                  t        |      5  t        j                  | |d       d d d        y # 1 sw Y   y xY w)	NrI   Int64r5   zjAttributes of Series are different

Attribute "dtype" are different
\[left\]:  Int64
\[right\]: int[32|64]Fcheck_dtyper6   T)
r   rj   arrayastypeintr   r   r   r;   r   rV   rW   r   s      r   1test_assert_series_equal_extension_dtype_mismatchrz     su    "((9G45DKKEC 4E:	~S	1 >
tU=> > >   -BBc                  6   t        t        j                  dd      gd      } | j                  t              }d}t        j                  | |d       t        j                  t        |      5  t        j                  | |d	       d d d        y # 1 sw Y   y xY w)
Nr   r   intervalr5   zyAttributes of Series are different

Attribute "dtype" are different
\[left\]:  interval\[int64, right\]
\[right\]: objectFrt   r6   T)
r   rj   Intervalrw   rS   r   r   r   r;   r   ry   s      r   0test_assert_series_equal_interval_dtype_mismatchr   !  sz    2;;q!$%Z8DKKEC 4E:	~S	1 >
tU=> > >r{   c                  J    G d dt               } t        ddg      }t        ddg      } | ddg      }t        j                  ||d       t        j                  ||d       t        j                  ||d       t        j                  ||d       t        j                  t
        d	      5  t        j                  ||d       d d d        t        j                  t
        d	      5  t        j                  ||d       d d d        y # 1 sw Y   FxY w# 1 sw Y   y xY w)
Nc                       e Zd Zy)/test_series_equal_series_type.<locals>.MySeriesN)__name__
__module____qualname__ r   r   MySeriesr   3  s    r   r   r   r)   F)check_series_typeTzSeries classes are differentr6   r   r   r   r   r;   r   )r   r.   r/   s3s       r   test_series_equal_series_typer   2  s    6  
AB	AB	1a&	B2rU;2rT:2rU;2rU;	~-K	L ?
r2>? 
~-K	L ?
r2>? ?? ?? ?s   /D+DDD"c                     t        ddg      } t        ddg      }t        ddg      }t        j                  | |d       t        j                  || d       d}t        j                  t
        |      5  t        j                  | |d       d d d        d}t        j                  t
        |      5  t        j                  || d       d d d        y # 1 sw Y   HxY w# 1 sw Y   y xY w)Nr
   r   Tcheck_exactzzSeries are different

Series values are different \(100\.0 %\)
\[index\]: \[0, 1\]
\[left\]:  \[a, b\]
\[right\]: \[b, a\]r6   zzSeries are different

Series values are different \(100\.0 %\)
\[index\]: \[0, 1\]
\[left\]:  \[b, a\]
\[right\]: \[a, b\]r   )r.   r/   r   r   s       r   &test_series_equal_exact_for_nonnumericr   G  s    	c
	B	c
	B	c
	B2rt42rt4C 
~S	1 9
r2489C 
~S	1 9
r2489 99 99 9s   5C3C!C!C*c                  p    t        g dd      } t        g dd      }t        j                  | |d       y )NrI   rs   r5   Int32Frt   r   r   r   rU   s     r   8test_assert_series_equal_ignore_extension_dtype_mismatchr   c  ,    )7+D9G,E4E:r   c                  p    t        g dd      } t        g dd      }t        j                  | |d       y )NrI   rs   r5   int64Frt   r   rU   s     r   Dtest_assert_series_equal_ignore_extension_dtype_mismatch_cross_classr   j  r   r   c                  $   t        dg      } t        dg      j                  d      }t        j                  | |        t        j                  ||       t        j                  | |d       t        j                  || d       t	        j
                  t        d      5  t        j                  | |       d d d        t	        j
                  t        d      5  t        j                  | |       d d d        y # 1 sw Y   DxY w# 1 sw Y   y xY w)Nr   F)allows_duplicate_labels)check_flagsz<Flagsr6   )r   	set_flagsr   r   r   r;   r   rU   s     r   test_allows_duplicate_labelsr   q  s    1#;DA3K!!%!@E4&5%(4E:5$E:	~X	6 ,
tU+, 
~X	6 ,
tU+, ,, ,, ,s    C:D:DDc                     t        | g      }t        j                  ||j                                t	        j
                  |      }t        j                  ||j                  d             y )NT)deep)r   r   r   copyrj   Indexassert_index_equal)nulls_fixtureseridxs      r   %test_assert_series_equal_identical_nar     sN    
-
!C3
+ ((3-C#sxxTx23r   c            	      L   t        dddt        j                  ddg      g      } t        dddt        j                  ddg      g      }t        j                  | |        t        j                  | | d       t        j                  | |       t        j                  | |d       y )Nr   g=ۊ?g߷>g	ﰴ9?g?Tr   )r   nprv   r   r   )xys     r   %test_identical_nested_series_is_equalr     s    HH(*<=>		
	A 	HH(*<=>		
	A 1a 1aT21a 1aT2r   
datetime64timedelta64c                    t        g d      j                  |  d      }|j                  |  d      }t        j                  t        d      5  t        j                  ||       d d d        t        j                  ||d       |t        g d      j                  |  d      z  }t        j                  t        d	      5  t        j                  ||       d d d        t        j                  t        d	      5  t        j                  ||d       d d d        y # 1 sw Y   xY w# 1 sw Y   RxY w# 1 sw Y   y xY w)
N)iC i   iK3Ez[s]z[ms]z"Attributes of Series are differentr6   Frt   )r   r   r   Series are different)r   rw   r   r;   r   r   r   )r%   ser_sser_mss      r   %test_check_dtype_false_different_resor     s    /0775'FE\\UG4.)F	~-Q	R .
uf-.65e<
fY&&%~66F	~-C	D .
uf-. 
~-C	D A
uf%@A A. .. .A As$   DD+=D7D(+D47E rs   r   c                     t        dg|       }t        dg|       }t        j                  t        d      5  t	        j
                  ||       d d d        y # 1 sw Y   y xY w)Nl   ?&l, r5   l   ?&l, r   r6   rZ   )r%   rV   rW   s      r   test_large_unequal_intsr     sX     #$E2D$%U3E	~-C	D ,
tU+, , ,s   AA!r   valg      @c                     t        dd| g|      }t        t        j                  dd| g            }t        j                  ||d|       y )Nr   r)   r5   F)ru   r   )r   rj   rv   r   r   )r   r   r%   rV   rW   s        r    test_ea_and_numpy_no_dtype_checkr     sC    
 1a+U+D288Q3K()E4E{Sr   c                  d   t        g d      } t        g d      }t        j                  | |d       t        j                  | j	                         |j	                         d       t        j
                  | j                  d      j                  |j                  d      j                  d       y )N)Q      y   &   J   H   r   r      r   r      r   r   )r   	   r   r   r   r   r   r   r   r   r   r   r   r   rA   r8   rs   )r   r   r   assert_frame_equalto_frameassert_extension_array_equalrw   valuesrU   s     r    test_assert_series_equal_int_tolr     s|    MNDJKE4S1$--/5>>+;#F##G##U\\'%:%A%Ar   zleft_idx, right_idx)r   g?g?g333333?g?r      )r   r   r   r   r   r   )r
   r
   r
   r   r   r   )r   r)   r   r   r2   l    a$)r   r)   r   r   r2   l    a$z"check_exact_index defaults to True)reason)marksc                 (   t        t        j                  dt              |       }t        t        j                  dt              |      }t	        j
                  ||       t	        j                  |j                         |j                                y )Nr   r5   )r   r   zerosrx   r   r   r   r   )left_idx	right_idxser1ser2s       r   2test_assert_series_equal_check_exact_index_defaultr     s_    J "((1C((3D"((1C()4D4&$--/4==?;r   )6numpyr   r   pandasrj   r   r   r   pandas._testing_testingr   r   r   r   markparametrizer-   rp   r   r$   r0   r=   from_recordsrC   rF   rM   rQ   rX   r\   r_   rc   rl   rq   rz   r   r   r   r   r   r   r   r   r   r   rS   r   r   r   linspace
MultiIndexfrom_arraysparamxfailr   r   r   r   <module>r      s"      
 +&,-& %(DKh!HI: J: 	q5A;	ed5k"	hh(	hf&	q58	@	@ 	)	)	** );=M(NO%89
5 : P
5  D$<1v.D$<Sz2*	
 #I""!fC:T4LA#sa"I""CjSztEcSVZa8	
*1+*1 e}5A 6A u6C 7CP222$2O.>">"?*98;;,434 <"?@A AA" 7G"45, 6, 4.1u6C)T * 7 2T	  BHH/0BHH[R[[Aq)*	

 MM%%'9;U&VWMM%%'9;2;;q!Q;O&PQ	

 MM%%/1PQ MM%%/1PQ		
 	BHH45BHH45++##+O#P	

 	MM%%#%DE MM%%#%DE ++##+O#P	
-"F<G"F<r   