
    Owg'              	          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"                  j%                  dddg      d	        Zd
 Zd Zd Zd Zd Zej"                  j%                  dddg      d        Zd Zej"                  j%                  dddej6                  ej6                  fe	e	fej6                  e	fg      d        Zd Zej"                  j%                  dddg      d        Zd Zd Z d Z!d Z"d Z#ej"                  j%                  dddg      ej"                  j%                  dddg      d                Z$ej"                  j%                  dddg      d!        Z%y)"    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        y # 1 sw Y   y xY w)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/horilla/myenv/lib/python3.12/site-packages/pandas/tests/util/test_assert_index_equal.py test_index_equal_levels_mismatchr%      s[    C D!!"JKD	~S	1 7
dD67 7 7s   A$$A-c                     d}t        j                  g d      }t        j                  g d      }t        j                  t        |      5  t        j                  |||        d d d        y # 1 sw Y   y xY w)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-   "   sf    ;C !!"JKD!!"JKD	~S	1 C
dDkBC C Cs   A..A7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)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   sX    >C DD	~S	1 C
dDkBC C Cs   AA#r   Fequivc                 d    t        g d      }t        d      }t        j                  |||        y )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    c                     d}t        g d      }t        g dt        j                        }t        j                  t
        |      5  t        j                  ||d|        d d d        y # 1 sw Y   y xY w)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 O
dD+NO O Os   A++A4c                     d}t        g d      }t        t        d            }t        j                  t
        |      5  t        j                  ||d|        d d d        y # 1 sw Y   y xY w)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eAhD	~S	1 O
dD+NO O Os   A""A+c                    t        g d      }t        g d      }| r?d}t        j                  t        |      5  t	        j
                  |||        d d d        y t	        j
                  |||        y # 1 sw Y   y xY w)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   sw    D%&DI ]]>5 	G!!$+F	G 	G 	dDkB	G 	Gs   A55A>c                    t        g d      }t        g d      }| |d}| s|dk  r>d}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)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($7FdVmC ]]>5 	8!!$77	8 	8 	dD3F3	8 	8s   A==Bc                     t        g d      }t        g d      }| |d}d}t        j                  t        |      5  t	        j
                  ||fi | d d d        y # 1 sw Y   y xY w)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      sa    DD($7F8C 
~S	1 4
dD3F34 4 4s   AA'check_orderTc                 
   t        g d      }t        g d      }d}|r?t        j                  t        |      5  t	        j
                  ||| |d       d d d        y t	        j
                  ||| |d       y # 1 sw Y   y xY w)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 	!!d$D	 	
 	$Kd	
	 	s   A99Bc                     t        j                  g d      }t        j                  g d      }| |d}d}t        j                  t        |      5  t        j                  ||fi | d d d        y # 1 sw Y   y xY w)Nr(   r   rC   r'   r   r+   rE   s         r$   &test_index_equal_level_values_mismatchrN      so    !!"JKD!!"JKD($7F;C 
~S	1 4
dD3F34 4 4s   A22A;zname1,name2)Nx)rO   rO   c                 B   t        g d|       }t        g d|      }| |k(  s| |u rt        j                  ||       y | dk(  rdn| } |dk(  rdn|}d|  d| d}t        j                  t
        |      5  t        j                  ||       d d d        y # 1 sw Y   y xY w)	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      s    
 'D'D~%
dD)#5#5  s	 ]]>5 	.!!$-	. 	. 	.s   5BBc                 J   |rd}nd}d| d| d}t        t        ddg            }t        t        ddgg d	            }| r=t        j                  t        |
      5  t        j                  |||        d d d        y t        j                  |||        y # 1 sw Y   y xY w)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`      s      !!&s.C c3Z()Dc3ZODED]]>5 	S!!$@QR	S 	S 	dD<MN	S 	Ss   BB"c                 8   d}t        t        d            }t        t        t        d                  }| r@|r>t	        j
                  t        |      5  t        j                  ||dd       d d d        y t        j                  ||| |       y # 1 sw Y   y xY w)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 JrN+DDrO,DU]]>5 	R!!$DQ	R 	R 	$*;5	
	R 	Rs   BBc                     d} t        t        t        j                  d      g      }t        t        t        g      }t        j                  t        |       5  t        j                  ||       d d d        y # 1 sw Y   y xY w)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      sd    C "bmmE*+,D"cD	~S	1 *
dD)* * *s   A77B c                      t        ddgd      } t        ddgd      }t        j                  t        d      5  t	        j
                  | |dd	
       d d d        y # 1 sw Y   y xY w)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 O
dDeNO O Os   AA&c                  N    t        g d      } t        j                  | | d       y )N)foobar*   FrJ   r   r   r   )idxs    r$   #test_assert_index_equal_mixed_dtyperv     s    
"
#C#s6r4   c                 p    t        ddg|       }t        ddg|       }t        j                  ||d       y )Nr   r   r6   Frs   rt   )any_numeric_ea_dtyper"   r#   s      r$   ,test_assert_index_equal_ea_dtype_order_falsery     s6    !Q34D!Q34D$%8r4   c                  p    t        ddgd      } t        ddgd      }t        j                  | |d       y )Nr   r   rX   r6   Frs   rt   rm   s     r$   /test_assert_index_equal_object_ints_order_falser{   !  s4    !Qx(D!Qx(D$%8r4   r^   rl   c                     t        ddgd      }t        dt        gd      }t        j                  t        d      5  t        j                  ||| |       d d d        y # 1 sw Y   y xY w)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 

$KCT	

 
 
s   A!!A*c                    t        j                  t        t        j                  ddgt        j
                              g      }t        j                  t        t        j                  ddgt        j                              g      }| r=t        j                  t        d      5  t        j                  |||        d d d        y t        j                  |||        y # 1 sw Y   y xY w)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     !!;rxxAbii/P#Q"RSD!!;rxxAbhh/O#P"QRD]]"J
 	S !!$@QR	S 	S
 	dD<MN	S 	Ss   &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$CC 5'"233 43OOC"4$4 u6
 7
*4 *rvvrvv.c
RVVSMJ.	.&O. 5$-0
 1
**O799 ,tUm<u6
 7 =
 ,tUm<
O =
Or4   