
    Eg'              	          d dl Zd dlZd dlmZmZmZmZmZm	Z	m
Z
 d dlmZ d Zd Zd Zej                            dddg          d	             Zd
 Zd Zd Zd Zd Zej                            dddg          d             Zd Zej                            dddej        ej        fe	e	fej        e	fg          d             Zd Zej                            dddg          d             Zd Zd Z d Z!d Z"d Z#ej                            dddg          ej                            dddg          d                          Z$ej                            dddg          d!             Z%dS )"    N)NACategoricalCategoricalIndexIndex
MultiIndexNaT
RangeIndexc                      d} t          g d          }t          j        g d          }t          j        t
          |           5  t          j        ||d           d d d            d S # 1 swxY w Y   d S )NzIndex are different

Index levels are different
\[left\]:  1, Index\(\[1, 2, 3\], dtype='int64'\)
\[right\]: 2, MultiIndex\(\[\('A', 1\),
            \('A', 2\),
            \('B', 3\),
            \('B', 4\)\],
           \)         )Ar   r   r   Br   r      matchFexact)r   r   from_tuplespytestraisesAssertionErrortmassert_index_equalmsgidx1idx2s      ^/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/tests/util/test_assert_index_equal.py test_index_equal_levels_mismatchr%      s    C D!"J"J"JKKD	~S	1	1	1 7 7
dD66667 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s   A**A.1A.c                     d}t          j        g d          }t          j        g d          }t          j        t          |          5  t          j        |||            d d d            d S # 1 swxY w Y   d S )NMultiIndex level \[1\] are different

MultiIndex level \[1\] values are different \(25\.0 %\)
\[left\]:  Index\(\[2, 2, 3, 4\], dtype='int64'\)
\[right\]: Index\(\[1, 2, 3, 4\], dtype='int64'\)r   r   r   r   r   r   check_exactr   r   r   r   r   r   r   r*   r!   r"   r#   s       r$    test_index_equal_values_mismatchr-   "   s    ;C !"J"J"JKKD!"J"J"JKKD	~S	1	1	1 C C
dDkBBBBC C C C C C C C C C C C C C C C C Cs   
A//A36A3c                     d}t          g d          }t          g d          }t          j        t          |          5  t	          j        |||            d d d            d S # 1 swxY w Y   d S )NzIndex are different

Index length are different
\[left\]:  3, Index\(\[1, 2, 3\], dtype='int64'\)
\[right\]: 4, Index\(\[1, 2, 3, 4\], dtype='int64'\)r   )r   r   r   r   r   r)   r   r   r   r   r   r   r,   s       r$    test_index_equal_length_mismatchr0   0   s    >C DD	~S	1	1	1 C C
dDkBBBBC C C C C C C C C C C C C C C C C Cs    A%%A),A)r   Fequivc                 t    t          g d          }t          d          }t          j        |||            d S )N)r   r   r   r   r   )r   r	   r   r   )r   r"   r#   s      r$   test_index_equal_classr3   >   s<    Da==D$E222222    c                     d}t          g d          }t          g dt          j                  }t          j        t
          |          5  t          j        ||d|            d d d            d S # 1 swxY w Y   d S )NzcIndex are different

Attribute "inferred_type" are different
\[left\]:  integer
\[right\]: floatingr   dtyper   Tr   r*   )r   npfloat64r   r   r   r   r   r,   s       r$   )test_int_float_index_equal_class_mismatchr;   F   s    C D"*---D	~S	1	1	1 O O
dD+NNNNO O O O O O O O O O O O O O O O O Os   A22A69A6c                     d}t          g d          }t          t          d                    }t          j        t
          |          5  t          j        ||d|            d d d            d S # 1 swxY w Y   d S )NzkIndex are different

Index classes are different
\[left\]:  Index\(\[1, 2, 3\], dtype='int64'\)
\[right\]: r   r   r   Tr8   )r   r	   ranger   r   r   r   r   r,   s       r$   %test_range_index_equal_class_mismatchr>   T   s    C DeAhhD	~S	1	1	1 O O
dD+NNNNO O O O O O O O O O O O O O O O O Os   A11A58A5c                    t          g d          }t          g d          }| rOd}t          j        t          |          5  t	          j        |||            d d d            d S # 1 swxY w Y   d S t	          j        |||            d S )Nr   r   g      @)r   r   go   @zIndex are different

Index values are different \(33\.33333 %\)
\[left\]:  Index\(\[1.0, 2.0, 3.0], dtype='float64'\)
\[right\]: Index\(\[1.0, 2.0, 3.0000000001\], dtype='float64'\)r   r)   r/   )r*   r"   r#   r!   s       r$   test_index_equal_values_closerA   b   s    D%%%&&D 
CI ]>555 	G 	G!$+FFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	dDkBBBBBBs   A''A+.A+c                     t          g d          }t          g d          }| |d}| s|dk     rKd}t          j        t          |          5  t	          j        ||fi | d d d            d S # 1 swxY w Y   d S t	          j        ||fi | d S )Nr@   )r   r   g9m4 @r*   rtolgMb@?zIndex are different

Index values are different \(33\.33333 %\)
\[left\]:  Index\(\[1.0, 2.0, 3.0], dtype='float64'\)
\[right\]: Index\(\[1.0, 2.0, 3.0001\], dtype='float64'\)r   r/   r*   rD   r"   r#   kwargsr!   s         r$   "test_index_equal_values_less_closerG   s   s   D  D($77F 
4dVmmC ]>555 	8 	8!$77777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	dD33F33333s   A..A25A2c                     t          g d          }t          g d          }| |d}d}t          j        t          |          5  t	          j        ||fi | d d d            d S # 1 swxY w Y   d S )Nr   )r   r   r   rC   zIndex are different

Index values are different \(33\.33333 %\)
\[left\]:  Index\(\[1, 2, 3\], dtype='int64'\)
\[right\]: Index\(\[1, 2, 4\], dtype='int64'\)r   r/   rE   s         r$   test_index_equal_values_too_farrI      s    DD($77F8C 
~S	1	1	1 4 4
dD33F3334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s   A&&A*-A*check_orderTc                 "   t          g d          }t          g d          }d}|rOt          j        t          |          5  t	          j        ||| |d           d d d            d S # 1 swxY w Y   d S t	          j        ||| |d           d S )Nr   )r   r   r   zIndex are different

Index values are different \(66\.66667 %\)
\[left\]:  Index\(\[1, 2, 3\], dtype='int64'\)
\[right\]: Index\(\[3, 2, 1\], dtype='int64'\)r   T)r*   rD   rJ   Fr/   )r*   rD   rJ   r"   r#   r!   s         r$   %test_index_equal_value_order_mismatchrL      s   DD8C  
]>555 	 	!d$D   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	$Kd	
 	
 	
 	
 	
 	
s   A))A-0A-c                     t          j        g d          }t          j        g d          }| |d}d}t          j        t          |          5  t          j        ||fi | d d d            d S # 1 swxY w Y   d S )Nr(   r   rC   r'   r   r+   rE   s         r$   &test_index_equal_level_values_mismatchrN      s    !"J"J"JKKD!"J"J"JKKD($77F;C 
~S	1	1	1 4 4
dD33F3334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s   A00A47A4zname1,name2)Nx)rO   rO   c                 `   t          g d|           }t          g d|          }| |k    s| |u rt          j        ||           d S | dk    rdn| } |dk    rdn|}d|  d| d}t          j        t
          |          5  t          j        ||           d d d            d S # 1 swxY w Y   d S )	Nr   namerO   z'x'zBIndex are different

Attribute "names" are different
\[left\]:  \[z\]
\[right\]: \[z\]r   )r   r   r   r   r   r   )name1name2r"   r#   r!   s        r$   test_index_equal_namesrU      s4   
 '''D'''D~~%
dD)))))#5#5   	   ]>555 	. 	.!$---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s    B##B'*B'c                 r   |rd}nd}d| d| d}t          t          ddg                    }t          t          ddgg d	                    }| rMt          j        t          |
          5  t          j        |||            d d d            d S # 1 swxY w Y   d S t          j        |||            d S )NstringobjectzIndex 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\)ab)rY   rZ   c)
categoriesr   check_categorical)r   r   r   r   r   r   r   )r^   using_infer_stringr7   r!   r"   r#   s         r$   "test_index_equal_category_mismatchr`      sM    . 	. . "'. . .C c3Z(())Dc3ZOOODDDEED O]>555 	S 	S!$@QRRRR	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	dD<MNNNNNNs   .BBBc                 h   d}t          t          d                    }t          t          t          d                              }| rP|rNt	          j        t          |          5  t          j        ||dd           d d d            d S # 1 swxY w Y   d S t          j        ||| |           d S )NzIndex are different

Index classes are different
\[left\]:  RangeIndex\(start=0, stop=10, step=1\)
\[right\]: Index\(\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\], dtype='int64'\)
   r   T)r^   r   )	r   r	   listr=   r   r   r   r   r   )r^   r   r!   rcaticats        r$   !test_index_equal_range_categoriesrf      s   MC JrNN++DDrOO,,D 
U 
]>555 	R 	R!$DQQQQ	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	$*;5	
 	
 	
 	
 	
 	
s   'BBBc                  "   d} t          t          t          j        d          g          }t          t          t          g          }t          j        t          |           5  t          j	        ||           d d d            d S # 1 swxY w Y   d S )NzaIndex are different

Attribute "inferred_type" are different
\[left\]:  mixed
\[right\]: datetimenatr   )
r   r   r9   
datetime64r   r   r   r   r   r   r    s      r$   0test_assert_index_equal_different_inferred_typesrj      s    C "bmE**+,,D"cD	~S	1	1	1 * *
dD)))* * * * * * * * * * * * * * * * * *s   !BBBc                      t          ddgd          } t          ddgd          }t          j        t          d          5  t	          j        | |dd	
           d d d            d S # 1 swxY w Y   d S )Nr   r   rY   rQ   rZ   z"names" are differentr   FT)rJ   check_namesr/   r"   r#   s     r$   9test_assert_index_equal_different_names_check_order_falsern     s    !Qc"""D!Qc"""D	~-D	E	E	E O O
dDeNNNNO O O O O O O O O O O O O O O O O Os   A((A,/A,c                  V    t          g d          } t          j        | | d           d S )N)foobar*   FrJ   r   r   r   )idxs    r$   #test_assert_index_equal_mixed_dtyperv     s4    
"""
#
#C#s666666r4   c                     t          ddg|           }t          ddg|           }t          j        ||d           d S )Nr   r   r6   Frs   rt   )any_numeric_ea_dtyper"   r#   s      r$   ,test_assert_index_equal_ea_dtype_order_falsery     sN    !Q3444D!Q3444D$%888888r4   c                      t          ddgd          } t          ddgd          }t          j        | |d           d S )Nr   r   rX   r6   Frs   rt   rm   s     r$   /test_assert_index_equal_object_ints_order_falser{   !  sL    !Qx(((D!Qx(((D$%888888r4   r^   rl   c                     t          ddgd          }t          dt          gd          }t          j        t          d          5  t          j        ||| |           d d d            d S # 1 swxY w Y   d S )Nr   r   Int64r6   z50.0 %r   )rl   r^   )r   r   r   r   r   r   r   )rl   r^   r"   r#   s       r$   *test_assert_ea_index_equal_non_matching_nar~   (  s     !Qw'''D!R(((D	~X	6	6	6 
 

$KCT	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   A--A14A1c                    t          j        t          t          j        ddgt          j                            g          }t          j        t          t          j        ddgt          j                            g          }| rMt          j        t          d          5  t          j        |||            d d d            d S # 1 swxY w Y   d S t          j        |||            d S )Nr   r   r6   z%^MultiIndex level \[0\] are differentr   r]   )r   from_arraysr   r9   arrayuint64int64r   r   r   r   r   )r^   r"   r#   s      r$   /test_assert_multi_index_dtype_check_categoricalr   4  s>    !;rxAbi/P/P/P#Q#Q"RSSD!;rxAbh/O/O/O#P#P"QRRD O]"J
 
 
 	S 	S !$@QRRRR	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S
 	dD<MNNNNNNs   "CCC)&numpyr9   r   pandasr   r   r   r   r   r   r	   pandas._testing_testingr   r%   r-   r0   markparametrizer3   r;   r>   rA   rG   rI   rL   rN   nanrU   r`   rf   rj   rn   rv   ry   r{   r~   r    r4   r$   <module>r      s                              7 7 7$C C CC C C 5'"2333 3 433O O OO O OC C C"4 4 4$4 4 4 u66
 
 76
*4 4 4 *rvrv.c
RVSMJ . .	 .&O O O. 5$-00
 
 10
** * *O O O7 7 79 9 99 9 9 ,tUm<<u66
 
 76 =<
 ,tUm<<
O 
O =<
O 
O 
Or4   