
    ٘go
                        d dl mZ d dlZd dlZd dlZd dlmZ d dl	m
Z
 ddZej                  ded   fd       Z G d d	      Zej                  j!                  d
ej"                  ej$                  j&                  j(                  fej*                  ej$                  j&                  j,                  fej.                  ej$                  j&                  j0                  fg      d        Zd Zd Zd Zy)    )	GeneratorN)accessorreturnc                       G d dt         j                        } t         |              D cg c]  }|j                  d      r| }}|ddgk(  sJ y c c}w )Nc                   $    e Zd ZU dZeed<   ddZy)test_dirname_mixin.<locals>.X   yNc                     d| _         y )N   )zselfs    n/var/www/html/janusapi.askjitendra.com/env/lib/python3.12/site-packages/pandas/tests/test_register_accessor.py__init__z&test_dirname_mixin.<locals>.X.__init__   s	    DF    r   N)__name__
__module____qualname__xint__annotations__r    r   r   Xr      s    	r   r   _r   r   )r   DirNamesMixindir
startswith)r   	attr_nameresults      r   test_dirname_mixinr"      sT    H""  *-QSSI9M9Mc9RiSFSc3Z Ts   AA)NNNc              #      K   	 d 	 t        | |       | j                  j                  |       y# t        $ r Y 'w xY w# 	 t        | |       n# t        $ r Y nw xY w| j                  j                  |       w xY ww)z[Ensure that an attribute added to 'obj' during the test is
    removed when we're done
    N)delattrAttributeError
_accessorsdiscard)objattrs     r   ensure_removedr*      sx     
%	C 	t$  			C 		t$sU   A=A  1 A=	=A==A= A:AA:	AA:AA::A=c                   *    e Zd ZddZed        Zd Zy)
MyAccessorNc                      || _         d| _        y )Nitem)r(   r.   )r   r(   s     r   r   zMyAccessor.__init__*   s    	r   c                     | j                   S Nr.   r   s    r   propzMyAccessor.prop.   s    yyr   c                     | j                   S r0   r1   r   s    r   methodzMyAccessor.method2   s    yyr   r   )r   r   r   r   propertyr2   r4   r   r   r   r,   r,   )   s       r   r,   zobj, registrarc                 x   t        | d      5  t        t        |             }  |d      t               | t        j
                  ur | g       n | g t              }|j                  j                  dk(  sJ t        t        |             }||z  dhk(  sJ d| j                  v sJ 	 d d d        y # 1 sw Y   y xY w)Nminedtyper.   )
r*   setr   r,   pdSeriesobjectr7   r2   r&   )r(   	registrarbeforeoafters        r   test_registerrB   6   s     
V	$ (SX	&*%"))+CGRv1Fvv{{f$$$CHF8+++'''( ( (s   BB00B9c                     t        t        j                  d      5  t        j                  j                  j                  d      t               t        j                  ddg      } | j                  j                  | u sJ | j                  j                  dk(  sJ | j                  j                         dk(  sJ 	 d d d        y # 1 sw Y   y xY w)Nr7   r	      r.   )r*   r;   r<   api
extensionsregister_series_accessorr,   r7   r(   r2   r4   )ss    r   test_accessor_worksrI   I   s    			6	* )
226::FIIq!fvvzzQvv{{f$$$vv}}&((() ) )s   BCCc                     d} t        j                  t        |       5  t        t        j
                  d      5  t        t        j
                  dd       t	        j                  j                  j                  d      t               t	        j
                  ddg      }|j                  j                  dk(  sJ 	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nz.*MyAccessor.*fake.*Series.*matchfake{   r	   rD   r.   )tmassert_produces_warningUserWarningr*   r;   r<   setattrrE   rF   rG   r,   rM   r2   )rL   rH   s     r   test_overwrite_warnsrS   T   s    +E		#	#Ku	= )BIIv. 	)BIIvs+FF66v>zJ		1a&!A66;;&(((		)) )	) 	)) )s#   CB C:CC	CC c                  x   t        t        j                  d      5  t        j                  j                  j                  d       G d d             } t        j                  t        d      5  t        j                  g t              j                   d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nbadc                       e Zd ZddZy)(test_raises_attribute_error.<locals>.BadNc                     t        d      )Nwhoops)r%   )r   datas     r   r   z1test_raises_attribute_error.<locals>.Bad.__init__c   s    $X..r   r   )r   r   r   r   r   r   r   BadrW   a   s    /r   r[   rY   rK   r8   )r*   r;   r<   rE   rF   rG   pytestraisesr%   r=   rU   )r[   s    r   test_raises_attribute_errorr^   ^   s    			5	) ,				3	3E	:	/ 	/ 
;	/ ]]>: 	,IIb'++	,, ,	, 	,, ,s$   AB0-&B$B0$B-	)B00B9r   )collections.abcr   
contextlibr\   pandasr;   pandas._testing_testingrO   pandas.corer   r"   contextmanagerr*   r,   markparametrizer<   rE   rF   rG   	DataFrameregister_dataframe_accessorIndexregister_index_accessorrB   rI   rS   r^   r   r   r   <module>rl      s    %        %+;!< % %
 
 	BFF%%>>?	rvv((DDE	266$$<<=(())	,r   