
    Owg                     F   d dl Zd dlZd dlmZ d dlZd dlmZ	 d dl
mZ ej                  j                  d      d        Zej                  j                  d      ej                  j                  dej                   dg      d               Zd Zej                  j                  dej                   dg      d	        Zej                  j(                  ej                  j+                   e       d
      d               Zej                  j                  dddg      d        Zy)    N)using_pyarrow_string_dtype)allow_na_opsz3ignore:PeriodDtype\[B\] is deprecated:FutureWarningc           	         | }t        j                  |t        dt        |      dz               }|j	                         }t        t        j                  |j                              }t        |t        j                        rIt        j                  j                  |      }|j                  |_        t        j                  ||d       y t        |t        j                         rnt        j                   ||j"                        }t        |j"                  t        j$                        r|j'                         }t        j                  ||d       y t        j(                  |      }t        j*                  ||       y )N   Texactdtype)nprepeatrangelenuniquelistdictfromkeysvalues
isinstancepd
MultiIndexfrom_tuplesnamestmassert_index_equalIndexr
   DatetimeTZDtype	normalizearrayassert_numpy_array_equal)index_or_series_objobjresultunique_valuesexpecteds        T/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/base/test_unique.pytest_uniquer&      s    
C
))Cq#c(Q,/
0CZZ\F szz23M#r}}%==,,];
fhd;	C	"88M;cii!3!34))+H
fhd;88M*
##FH5    null_objc           	         |}t        |      st        j                  d       nWt        |      dk  rt        j                  d       n3t	        |t
        j                        rt        j                  d|  d       |j                  }| |dd t        |      }t        j                  |t        dt        |      dz               } |||j                        }|j                         }t        j                  |j                         }|D cg c]  }t        j"                  |      r| }	}| g|	z   }
t	        |t
        j$                        r~t        j$                  |
|j                        }t	        |j                  t
        j&                        r |j)                         }|j)                         }t+        j,                  ||d	
       y t        j.                  |
|j                        }t+        j0                  ||       y c c}w )N$type doesn't allow for NA operationsr   z%Test doesn't make sense on empty dataMultiIndex can't hold ''r      r	   Tr   )r   pytestskipr   r   r   r   _valuestyper   r   r   r
   r   r   r   r   isnullr   r   r   r   r   r   r   )r(   r    r!   r   klassrepeated_valuesr"   unique_values_rawvalunique_values_not_nullr#   r$   s               r%   test_unique_nullr8   !   s    C:;	SA;<	C	'-hZq9:[[FF1QKIEiiaVq(ABO
syy
1CZZ\Fcjj1 .?UcbiiPSncUUJ!77M#rxx 88M;cii!3!34%%'F))+H
fhd;88M;
##FH5 Vs   
H%Hc           	          | }t        j                  |t        dt        |      dz               }t        |j	                               }|j                  d      |k(  sJ y )Nr   Fdropna)r   r   r   r   r   nunique)r    r!   r$   s      r%   test_nuniquer=   F   sO    
C
))Cq#c(Q,/
0C3::< H;;e;$000r'   c           	          |}t        |      st        j                  d       n3t        |t        j
                        rt        j                  d|  d       |j                  }| |dd t        |      }t        j                  |t        dt        |      dz               } |||j                        }t        |t        j                        rV|j                         t        |j                        k(  sJ |j                  d	      t        |j                        dz   k(  sJ y t        |j!                               }|j                         t#        d|dz
        k(  sJ |j                  d	      t#        d|      k(  sJ y )
Nr*   r+   r,   r   r-   r   r	   Fr:   )r   r.   r/   r   r   r   r0   r1   r   r   r   r   r
   CategoricalIndexr<   
categoriesr   max)r(   r    r!   r   r3   r4   num_unique_valuess          r%   test_nunique_nullrC   M   s3   
C:;	C	'-hZq9:[[FF1QKIEiiaVq(ABO
syy
1C#r**+{{}CNN 3333{{%{(C,?!,CCCC

-{{}A'81'< ===={{%{(C3D,EEEEr'   zdecoding fails)reasonc                 B   d} | |gdz        }|j                         }t        |t        j                        r5t        j                  dgt              }t        j                  ||d       y t        j                  dgt              }t        j                  ||       y )Nu   r-   r	   Tr   )
r   r   r   r   objectr   r   r   r   r   )index_or_seriesuvalr!   r"   r$   s        r%   test_unique_bad_unicoderI   f   sx     D
4&1*
%CZZ\F#rxx 88XJf5
fhd;88XJf5
##FH5r'   r;   TFc                     t        j                  ddt         j                  t        j                  d t         j
                  g      }|j                  |       }| r|dk(  sJ y y )Nyesr   )r   SeriesNAr   nanNaTr<   )r;   serress      r%   test_nunique_dropnarR   w   sL     ))UE255"&&$?
@C
++f
C3!8$$18r'   )numpyr   r.   pandas._configr   pandasr   pandas._testing_testingr   pandas.tests.base.commonr   markfilterwarningsr&   parametrizerN   r8   r=   rC   
single_cpuxfailrI   rR    r'   r%   <module>r_      s      5   1 RS6 T6* RSbffd^4 6 5 T 6F1 bffd^4F 5F0 -/8HI6 J 6 D%=1% 2%r'   