
    Owg:                     4   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      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/d0d1g      d2        Zej                  j                  d3d0d1g      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(dC Z)ej                  j                  ddDdEg      dF        Z*ej                  j                  ddGdHg      dI        Z+ej                  j                  dde,g      ej                  j                  dJd0d1g      ej                  j                  dKddLg      dM                      Z-dN Z.dO Z/y)P    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      a/var/www/horilla/myenv/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??)float32r&   Float32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)	Nr5   r%   )r4   r5   r   gMb@?zSeries values are differentmatchrtol)r   absr   raisesr   r   r   r   )r"   r#   r%   r3   r;   r.   r/   r   s           r   test_less_preciser>   l   s     y=D	u	%B	u	%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$MultiIndex 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_typer8   )r   r=   r   r   r   )r.   r/   r   rF   r   s        r   test_series_equal_index_dtyperG   |   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   rC   rA   )r   r)   r   rD   r   r
   Series.index are differentr8   )rH   r   r   r=   r   r   r   r   )rH   r.   r/   s      r    test_series_equal_order_mismatchrN      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)NrJ   rC   rA   rK   rL   r8   )rP   rM   )rP   r.   r/   s      r    test_series_equal_index_mismatchrR      sk    			1B			1B]]>1MN 	D""2r{C	D 	D 	""bkB	D 	DrO   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)Nr7   z0check_like must be False if check_index is Falser8   FT)rP   rH   )r   objectr   r=   
ValueErrorr   r   leftrights     r   %test_series_invalid_param_combinationrY      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\)rJ   )r   r)   r   r   r8   r:   r   r   r=   r   r   r   r;   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\]rJ   r(   r8   r:   r[   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}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)NzSeries are different

Series values are different \(66\.66667 %\)
\[index\]: \[0, 1, 2\]
\[left\]:  \['a', 'b', 'c'\]
Categories \(3, string\): \[a, b, c\]
\[right\]: \['a', 'c', 'b'\]
Categories \(3, string\): \[a, b, c\]zSeries are different

Series values are different \(66\.66667 %\)
\[index\]: \[0, 1, 2\]
\[left\]:  \['a', 'b', 'c'\]
Categories \(3, object\): \['a', 'b', 'c'\]
\[right\]: \['a', 'c', 'b'\]
Categories \(3, object\): \['a', 'b', 'c'\]rC   )r
   rD   r   r8   r:   )r   r   r   r=   r   r   r   )r;   using_infer_stringr   r.   r/   s        r   -test_series_equal_categorical_values_mismatchrc      sh    -3 
O,	-B	O,	-B	~S	1 2
r2D12 2 2s   A11A:c                    d}t        t        j                  ddd            }t        t        j                  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)periodsfreqz
2019-02-02r8   r:   )r   pd
date_ranger   r=   r   r   r   r\   s       r   *test_series_equal_datetime_values_mismatchrj      so    TC 
lAC@	AB	lAC@	AB	~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)NstringrT   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   )
categoriesr8   )check_categorical)	r   r   listr   r=   r   r   r   r   )rn   rb   r%   r   r.   r/   s         r   &test_series_equal_categorical_mismatchrp     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)	NrJ   Int64r7   zjAttributes of Series are different

Attribute "dtype" are different
\[left\]:  Int64
\[right\]: int[32|64]Fcheck_dtyper8   T)
r   rh   arrayastypeintr   r   r   r=   r   rW   rX   r   s      r   1test_assert_series_equal_extension_dtype_mismatchry     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   intervalr7   zyAttributes of Series are different

Attribute "dtype" are different
\[left\]:  interval\[int64, right\]
\[right\]: objectFrs   r8   T)
r   rh   Intervalrv   rT   r   r   r   r=   r   rx   s      r   0test_assert_series_equal_interval_dtype_mismatchr~   +  sz    2;;q!$%Z8DKKEC 4E:	~S	1 >
tU=> > >rz   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   =  s    r   r   r   r)   F)check_series_typeTzSeries classes are differentr8   r   r   r   r   r=   r   )r   r.   r/   s3s       r   test_series_equal_series_typer   <  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\]r8   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   Q  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 )NrJ   rr   r7   Int32Frs   r   r   r   rV   s     r   8test_assert_series_equal_ignore_extension_dtype_mismatchr   m  ,    )7+D9G,E4E:r   c                  p    t        g dd      } t        g dd      }t        j                  | |d       y )NrJ   rr   r7   int64Frs   r   rV   s     r   Dtest_assert_series_equal_ignore_extension_dtype_mismatch_cross_classr   t  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<Flagsr8   )r   	set_flagsr   r   r   r=   r   rV   s     r   test_allows_duplicate_labelsr   {  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   copyrh   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   npru   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 differentr8   Frs   )r   r   r   Series are different)r   rv   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 rr   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, r7   l   ?&l, r   r8   r[   )r%   rW   rX   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)   r7   F)rt   r   )r   rh   ru   r   r   )r   r   r%   rW   rX   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   rB   r:   rr   )r   r   r   assert_frame_equalto_frameassert_extension_array_equalrv   valuesrV   s     r    test_assert_series_equal_int_tolr     s|    MNDJKE4S1$--/5>>+;#F##G##U\\'%:%A%Ar   c                  V   t        t        j                  dt              g d      } t        t        j                  dt              t        j                  ddd            }t        j                  | |       t        j                  | j                         |j                                y )N   r7   )r   g?g?g333333?g?r   r   r   )	r   r   zerosrw   linspacer   r   r   r   )ser1ser2s     r   ,test_assert_series_equal_index_exact_defaultr     sj    "((1C(*DED"((1C("++aA*>?D4&$--/4==?;r   )0numpyr   r   pandasrh   r   r   r   pandas._testing_testingr   r   r   r   markparametrizer-   ro   r   r$   r0   r>   from_recordsrD   rG   rN   rR   rY   r]   r`   rc   rj   rp   ry   r~   r   r   r   r   r   r   r   r   r   rT   r   r   r   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"CD%89
5 : E P
5  D$<1v.D$<Sz2*	
 #I""!fC:T4LA#sa"I""CjSztEcSVZa4	
*1+*1 e}5A 6A u6C 7CP22262O.>">"?*98;;,434 <"?@A AA" 7G"45, 6, 4.1u6C)T * 7 2T	<r   