
    Owg5              
       >   d dl Z d dlZd dlZd dlmc mZ d dlm	Z	m
Z
mZmZmZmZmZ ej"                  j%                  ddee
g      d        Zej"                  j%                  dd ej(                  d ej*                  d      	      g      d
        Zd Zej"                  j%                  dd ej(                  d ej*                  d      	      g      ej"                  j%                  dddg      ej"                  j%                  dddg      ej"                  j%                  dddg      d                             Zej"                  j%                  dg dg dg dgg d      ej"                  j%                  dee
ed gg d      d               Zd Zej"                  j%                  dg d      d         Zej"                  j%                  dg d      d!        Zd" Zd# Zd$ Z ej"                  j%                  d%e!eejD                  ee
g      d&        Z#d' Z$y)(    N)	DataFrameIndex
MultiIndexSeries_testingconcatoption_contextotherc                     | }ddg}|r	 ||      }n|} ||d      j                   j                  |d      }|j                  dk(  sJ y )Nabname)r   ,sep)strcatr   )index_or_seriesr
   boxvaluesresults        T/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/strings/test_cat.pytest_str_cat_namer      sW     C3ZFff%))--e-=F;;&       infer_stringFTpyarrow)marksc           	      :   t        d|      5  | } |dddddt        j                  g      }|j                  j	                         }d}||k(  sJ |j                  j	                  d      }d}||k(  sJ |j                  j	                  d	d
      }d}||k(  sJ t        j
                  dt        j                  dddt        j                  gt              } |g d      }|j                  j	                  |d      }t        j                  ||       |j                  j	                  t        |      d      }t        j                  ||       d}t        g d      }t        j                  t        |      5  |j                  j	                  |j                         d d d        t        j                  t        |      5  |j                  j	                  t        |             d d d        d d d        y # 1 sw Y   ZxY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nfuture.infer_stringr   r   caabbc-na_repzaabbc-_NA)r   r$   a_a_b_b_c_NAdfoodtype)aaza-bbbdcfooz--<If `others` contains arrays or lists \(or other list-likes.*123match)r	   npnanr   r   arrayobjecttmassert_equallistr   pytestraises
ValueErrorr   )	r   r   r   sr   expectedtrgxzs	            r   test_str_catrF       s    
-|	< & c3S"&&12 !!!#&!!!s40!!!!HHc2663UBFF;6J=> 1S)
) 473/
) N?#]]:S1 	 EEIIahh	  ]]:S1 	EEIId1g	K& &D	  	 	 	K& &s<   E-H:&G9 #H%H(H9H	>HH	
HHc                 L   | } |g d      }d}t        j                  t        |      5  |j                  j	                  d       d d d        t        j                  t        |      5  |j                  j	                  d       d d d        y # 1 sw Y   IxY w# 1 sw Y   y xY w)Nr   r   r    r(   z'Did you mean to supply a `sep` keyword?r5   |z    )r>   r?   r@   r   r   )r   r   rA   messages       r   #test_str_cat_raises_intuitive_errorrK   M   s    
C !A7G	z	1 			#	z	1 			&   s   B)BBB#r    dtype_targetr:   categorydtype_callerc           	         | }t        d|      5  t        g d|      }|t        k(  r|nt        |||j                        }t        g d|      }t        g d|dk(  rt        nd       }|t        k(  r|n"t        |t        ||      |j                        }|j
                  j                  |j                  |      }	t        j                  |	|       t        |j                  t        ||      	      }|j
                  j                  ||      }	t        j                  |	|       |j
                  j                  |j                  |      }	t        j                  |	|       t        |j                  |j                  	      }t        g d
|dk(  rt        nd       }|dk(  rt        n|j                  j                  j                  }
|t        k(  r|n/t        |t        |j
                  d d |
      |j                        }|j
                  j                  ||      }	t        j                  |	|       d d d        y # 1 sw Y   y xY w)Nr   )r   r   r   r   r*   indexr+   )r   r   r   r    )abr,   r-   acr:   r   rR   )r,   r,   r-   r-   r,      )r	   r   r   r+   r:   r   r   r   r;   r<   
categories)r   rO   rM   r   r   r   rA   rC   rB   r   r+   s              r   test_str_cat_categoricalrX   X   s    C	-|	< /*&l;A6!1AGG#D&l;$lh6NFTX

 e| a| <HNN 	 188-
) 1885,#?@1#&
) 188-
) 188188,*(H4&$
 '(28J8J8P8P e| HLL!,E:nn 	 1#&
)_/* /* /*s   H-IIdatarV         )g?g?g333333?)rV   r[   r   )integersfloatsmixed)idsr   c                 8    t        j                  | t              S )Nr*   )r7   r9   r:   )xs    r   <lambda>rc      s    BHHQf$= r   )r   r   r=   znp.arrayc                     t        g d      } | |      }d}t        j                  t        |      5  |j                  j                  |dd       d d d        y # 1 sw Y   y xY w)Nr   r   r    z;Concatenation requires list-likes containing only strings.*r5   outerr"   joinr$   )r   r>   r?   	TypeErrorr   r   )r   rY   rA   rC   msgs        r   test_str_cat_wrong_dtype_raisesrk      sU     	AD	A
GC	y	, /			!'#	./ / /s   AA$c           	         | }t        g d      }|t         k(  r|nt        ||      }t        g d|j                        }t        |t        ||      gd      }t        g d      }|t         k(  r|n t        |j                  |j                        }|j                  j                  |      }t        j                  ||       |j                  j                  |j                        }t        j                  ||       |j                  j                  ||g      }t        j                  ||       |j                  j                  ||j                  g      }t        j                  ||       g d|_         |g d      }|t         k(  r|n t        |j                  |j                        }|j                  j                  ||g      }t        j                  ||       |j                  j                  ||j                  g      }t        j                  ||       g d|_         |g d	      }|t         k(  r|n t        |j                  |j                        }|j                  j                  |      }t        j                  ||       d
}t        g d      }t        ||gd      }	t        j                  t        |      5  |j                  j                  |	j                         d d d        t        j                  t        |      5  |j                  j                  |j                  |j                  g       d d d        t        j                  t        |      5  |j                  j                  |j                  |g       d d d        d}t        dt        j                  dd g      }
t        j                  t        |      5  |j                  j                  |
dg       d d d        t        j                  t        |      5  |j                  j                  |
|g       d d d        t        j                  t        |      5  |j                  j                  |
|j                  g       d d d        t        j                  t        |      5  |j                  j                  |
|
|gg       d d d        t        j                  t        |      5  |j                  j                  t        |
             d d d        t        j                  t        |      5  |j                  j                  |
t        |
      g       d d d        t        j                  t        |      5  |j                  j                  d       d d d        t        j                  t        |      5  |j                  j                  t!        |j                  t#        |      g             d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   /xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   LxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)NrH   rU   ABCDrV   axis)aAabBbcCcdDd)r   r    r(   r   )aDabAbcBcdCd)aDdbAacBbdCcr0   r1   r5   z*others must be Series, Index, DataFrame,.*r   r    u)r   r   r   r   r   r   r;   r<   rR   r>   r?   r@   r7   r8   ri   setiterr=   )r   r   rA   rC   r(   rB   r   rD   rE   er   s              r   test_str_cat_mixed_inputsr      s   
C"#AE\vaq1A#1884A6!1%&Q/A12H%<xVHOO188-TH UUYYq\FOOFH% UUYYqxx FOOFH% UUYY1vFOOFH% UUYY188}%FOOFH% #AG/0H%<xVHOO188-THUUYY1vFOOFH% UUYY188}%FOOFH% #AG/0H%<xVHOO188-THUUYYq\FOOFH% JCA1vAA 
z	- 			!(( 
z	- (			188QXX&'( 
z	- !			188Q- ! 7CRVVS$'(A 
y	, 			1c( 
y	, 			1a& 
y	, !			1ahh- ! 
y	, 			1q!f+
 
y	, 			#a&
 
y	, 			1c!f+ 
y	, 			! 
y	, -			$$q'*+,- -_ ( (! !  ! ! 
 
  - -s   &W42X&(XXX((X5 Y %Y('Y2Y)1:Y54W>XXX%(X25X?YYY&)Y25Y>rh   )leftrf   innerrightc                 n   | }t        g dg d      }t        g dg d      }|j                  ||      \  }}|j                  j                  |d      }|t        k(  r!t	        |      }t	        |      }t	        |      }|j                  j                  ||d      }t        j                  ||       y )	NrH   rU   )rq   rn   Ero   r(   r   r   r   rh   r"   r#   rg   )r   alignr   r   r   r;   r<   )	r   rh   r   rA   rC   satarB   r   s	            r   test_str_cat_align_indexedr     s     C#+?@A#+?@AWWQTW"FBvvzz"Sz)H
e|!H2Y?UUYYqtCY0FOOFH%r   c                    t        g d      }t        g dg d      }t        ||gd      }t        g d      }|j                  |j                  j	                  |j                  |          }|j
                  j                  ||g| d	
      }t        j                  ||       |j
                  j                  || d	
      }t        j                  ||       t        j                  g d      }t        g d      }| dk(  r%|j                  j                  |j                        ng| dk(  r%|j                  j                  |j                        n=|j                  j                  |j                  j                  |j                              }|j                  |j                  j	                  ||          }|j
                  j                  ||g| d	
      }t        j                  ||       t        j                   t"        d      5  |j
                  j                  |t%        |      g|        d d d        d}	t        g d      j&                  }
t        j                   t(        |	      5  |j
                  j                  |
|        d d d        t        j                   t(        |	      5  |j
                  j                  ||
g|        d d d        y # 1 sw Y   xY w# 1 sw Y   YxY w# 1 sw Y   y xY w)NrH   r   r\   r      rV   rU   rV   rr   )aaabbbzc--dddz-ee)howr"   rg   rm   )aaAbbBzc-CddD-e-r   rf   zothers must be Series,.*r5   r   r0   r1   )r   r   locrR   rh   r   r   r;   assert_series_equalr7   r9   intersectionunionappend
differencer>   r?   ri   r=   r   r@   )rh   rA   rC   r(   expected_outerrB   r   r   rhs_idxrD   rE   s              r   test_str_cat_align_mixed_inputsr   %  sX   #$A#<8A1vAA?@N!!!'',,qwwD,"ABH UUYY1vDY5F68, UUYYqtCY0F68, 	%&A?@N 7? 	
QWW% 7? WW]]177#WW^^AGG..qww78  !!!'',,wD,"ABHUUYY1vDY5F68,	y(B	C +			1d1g,T	*+
 JC&&A 
z	-  			!$	  
z	- %			1a&t	$% %+ +   % %s$   
)K/K%0 K1K"%K.1K:c                    | }|}t        g d      }|t         k(  r|nt        ||      } |t        j                  gdz  t              }|t         k(  r|nt        ||      }|t        k(  r5t        t        j                  gdz  |j
                  |j                        }n#t        t        j                  gdz  t              }|j                  j                  |d      }t        j                  ||       |t        k(  rbt        t        j                  gdz  t        |j
                        }|j                  j                  |d      }t        j                  ||       y y )	NrH   rU   r   r*   rQ   r   r   )r+   rR   )r   r   r7   r8   r:   rR   r+   r   r   r;   r<   r   )r   index_or_series2r   r
   rA   rC   rB   r   s           r   test_str_cat_all_nar   W  s   
CE 	"#AE\vaq1Arvvhl&)Ae^!3A f}266(Q,aggQWWE "&&AV4UUYYqvY&FOOFH% 266(Q,fAGGD16*
vx0 r   c                     t        g d      } t        g dg d      }t        g d      }| j                  j                  t        || j                  g      dd      }t        j                  ||       t        d	d
gddg      }| j                  j                  |j                  dg   |j                  dg   gdd      }t        j                  ||       y )NrH   r   r   rU   )r   r   zc-cr   r   rf   r"   rg   zaa-zd-dr   r\   r   )r   r   r   r   r   r;   r   r   )rA   rC   rB   r   s       r   test_str_cat_special_casesr   s  s    #$A#<8A 9:HUUYYtQM*YEF68, uenQF3HUUYYqc
AEE1#J/gcYJF68,r   c                     t        t        j                  ddgg dgddg            } | j                         } | | j                  dkD     } | j
                  j                  d	      }| j                  j                  d	      }|j                  j                  |d
      }|j                  d   dk(  sJ |j                  j                  ||gd
      }|j                  d   dk(  sJ y )Ni  i  rZ   yearmonth)namesrU   rV   r    r   z2011 2z2011 2 2)
r   r   from_productreset_indexr   r   astyper   r   r   )dfstr_year	str_monthstr_bothstr_multiples        r   test_cat_on_filtered_indexr     s    	%%D\9%fg->

B 
	B	BHHqL	Bww~~e$H&I||	s3H<<?h&&&<<##Y	$:#DLA*,,,r   klassc                     t        g d      }|j                  j                   | g d            }t        g d      }t        j                  ||       y )Nre   )rb   yrE   )axbycz)r   r   r   r;   r   )r   rA   r   rB   s       r   test_cat_different_classesr     s@     	AUUYYu_-.F()H68,r   c                      t        g d      } t        j                  d      }t        j                  t
        |      5  | j                  j                  | j                         d d d        y # 1 sw Y   y xY w)N)AbCdeFGHIjkLLLmzothers must be Series, Index, DataFrame, np.ndarray or list-like (either containing only strings or containing only objects of type Series/Index/np.ndarray[1-dim])r5   )others)r   reescaper>   r?   ri   r   r   )psrJ   s     r   test_cat_on_series_dot_strr     s[    	3	4Bii	G 
y	0 "


"&&
!" " "s   'A..A7)%r   numpyr7   r>   pandas.util._test_decoratorsutil_test_decoratorstdpandasr   r   r   r   r   r;   r   r	   markparametrizer   param
skip_if_norF   rK   rX   r=   rk   r   r   r   r   r   r   tupler9   r   r    r   r   <module>r      sE   	   ) )   4"78	! 9	! ULFLL]R]]95MNO''T ULFLL]R]]95MNO T
+(J)?@(J)?@4* A A ,4*n 
-'   	UD=>/  
//c-L !DE& F&& !DE.% F.%b18--* 5$&%"HI- J-"r   