
    dF                        d dl mZ 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
mZ d dlmZ d dlZd dlmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ  G d	 d
          Z G d de          Z dS )    )annotations)datetimeN)	Timestamp)is_datetime64tz_dtypeis_integer_dtype)CategoricalDtype)
CategoricalIndexDatetimeIndexIndexIntervalIndex
MultiIndexPeriodIndex
RangeIndexSeriesTimedeltaIndexisna)BaseMaskedArrayc                     e Zd ZU dZded<   ej        d             Zd@dZd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z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*g          ej$        %                    d+d,d-g          ej$        %                    d.d)d*g          d/                                     Z(d0 Z)ej$        j*        d1             Z+d2 Z,d3 Z-d4 Z.d5 Z/d6 Z0d7 Z1d8 Z2d9 Z3d: Z4d; Z5d< Z6d= Z7d> Z8d? Z9d,S )ABasez/
    Base class for index sub-class tests.
    ztype[Index]
_index_clsc                     t          d          NzMethod not implementedNotImplementedErrorselfs    W/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/indexes/common.pysimple_indexzBase.simple_index)   s    !":;;;    returnr   c                     t          d          r   r   r   s    r   create_indexzBase.create_index-   s    !":;;;r   c                    d                     g d          }t          j        t          |          5  |                                  d d d            d S # 1 swxY w Y   d S )N|)zNIndex\(\.\.\.\) must be called with a collection of some kind, None was passedzPDatetimeIndex\(\) must be called with a collection of some kind, None was passedzQTimedeltaIndex\(\) must be called with a collection of some kind, None was passedz:__new__\(\) missing 1 required positional argument: 'data'z2__new__\(\) takes at least 2 arguments \(1 given\)match)joinpytestraises	TypeErrorr   )r   msgs     r   test_pickle_compat_constructionz$Base.test_pickle_compat_construction0   s    hh	 	 	
 
 ]9C000 	 	OO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   AAAc                \   |}dt          |          j         }t          j        t          |          5  |                    d           d d d            n# 1 swxY w Y   t          j        t          |          5  |                    dd           d d d            d S # 1 swxY w Y   d S )Nz\This method is only implemented for DatetimeIndex, PeriodIndex and TimedeltaIndex; Got type r%         )type__name__r(   r)   r   shiftr   r   idxr+   s       r   
test_shiftzBase.test_shiftA   s.   =(,S		(:= = 	 ].c::: 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	].c::: 	 	IIaOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA=B!!B%(B%c                    |}t          j        t          d          5   t          |          |g            d d d            d S # 1 swxY w Y   d S )Nz"Index.name must be a hashable typer%   name)r(   r)   r*   r1   r   r   r5   s      r    test_constructor_name_unhashablez%Base.test_constructor_name_unhashableM   s     ]9,PQQQ 	$ 	$DIIc####	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$s   AA
A
c           	        |}t          |t                    sZd|_        t          |          }t	          j        ||           t          |d          }d|_        t	          j        ||           d S ddg|_        t          |          }t	          j        |t          t          g dd          ddg                     t          |dd	g          }t	          j        |t          t          g dd          dd	g                     d S )
Nfoobarr8   ))r=   one)r=   two)r>   r?   )bazr@   )quxr?   )rB   r@   objectdtype)namesAB)
isinstancer   r9   r   tmassert_index_equalrF   )r   r   expectedresults       r   test_create_index_existing_namez$Base.test_create_index_existing_nameT   s\     (J// .	!HM8__F!&(3338%000F!HM!&(33333#U^HN8__F!   '
 
 
 !%.    $ 8C:666F!   '
 
 
 *      r   c                   |}t          |t                    rJ t          |          t          u rd S t          |j                  j        }t          |          j        }d                    d| dd| d| dg          }t          j        t          |          5  |dz   d d d            n# 1 swxY w Y   d                    d| d	d
| d| dg          }t          j        t          |          5  d|z   d d d            n# 1 swxY w Y   |
                    dd          }t          j        t          |          5  |dz   d d d            n# 1 swxY w Y   |
                    dd          }t          j        t          |          5  d|z   d d d            n# 1 swxY w Y   |
                    dd          }t          j        t          |          5  |dz   d d d            n# 1 swxY w Y   |
                    dd          }t          j        t          |          5  d|z   d d d            d S # 1 swxY w Y   d S )Nr$   z'unsupported operand type\(s\) for \*: 'z' and 'int'zIcannot perform (__mul__|__truediv__|__floordiv__) with this index type: ()r%   r/   z1unsupported operand type\(s\) for \*: 'int' and ''zLcannot perform (__rmul__|__rtruediv__|__rfloordiv__) with this index type: (*/z//)rI   r   r1   r   _datar2   r'   r(   r)   r*   replace)	r   r   r5   typclslmsgrmsgdiv_errfloordiv_errs	            r   test_numeric_compatzBase.test_numeric_compat   s    c:.....99F39oo&3ii xxK3KKK2%(2 2+.2 2 2
 
 ]9D111 	 	!GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	xxKSKKK2%(2 2+.2 2 2
 
 ]9D111 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ,,sC((]9G444 	 	!GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	,,sC((]9G444 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ||C..]9L999 	 	1HH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	||C..]9L999 	 	HH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sl   B..B25B26DDDEEEF$$F(+F( G22G69G6.IIIc                (   |}t          j        t          d          5  |                                 d d d            n# 1 swxY w Y   t          j        t          d          5  |                                 d d d            d S # 1 swxY w Y   d S )Nzcannot perform allr%   zcannot perform any)r(   r)   r*   allanyr:   s      r   test_logical_compatzBase.test_logical_compat   s   ]9,@AAA 	 	GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]9,@AAA 	 	GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s!   ?AA%BBBc                h    |}t          j        t          t          |                    |           d S N)rJ   rK   evalreprr:   s      r   test_repr_roundtripzBase.test_repr_roundtrip   s,    
d499oos33333r   c                    |}|                     d          }t          j        dd           5  t          |           dt	          |          vsJ 	 d d d            d S # 1 swxY w Y   d S )N2   zdisplay.max_seq_itemsz...)repeatpdoption_contextrd   strr:   s      r   test_repr_max_seq_item_settingz#Base.test_repr_max_seq_item_setting   s    jjnn6== 	) 	)IIIC(((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   #AA"%A"c                   i }t          |t                    r|j        |d<   nIt          |t          t          t
          f          rd S |j        t          k    r|j        dk    r
|j        |d<   t          |          } ||j
        fddi|}t          |j                  r-|                    d                              |j                  }t          |t          t           f          r|                    d           }t%          j        ||           t          |t                    r3 |d|j        dd|}t%          j        |j        |j        d	
           d S t          |t,                    rd S t          |          t.          u rt          |j        t0          j                  s ||j
        fddi|}t%          j        ||           t          |j        t4                    rt1          j        |j        j        |j        j                  sJ t%          j        |j        j        |j        j        d	
           t1          j        |j        j        |j        j                  sJ t%          j        |j        j        |j        j        d	
           d S |j        dk    rXt1          j        |j        j        |j        j                  sJ t%          j        |j        j        |j        j        d	
           d S |j        dk    r#t%          j        |j        |j                  sJ d S t?          |j                   ||j
        fddi|}t%          j        |j
        |j
        d	
           d S )NfreqbooleanrE   copyTUTCF)ordinalrp   same)
check_samezstring[python]zstring[pyarrow] ) rI   r   rn   r   r   r	   rE   rC   inferred_typer1   valuesr   tz_localize
tz_converttzr
   r   
_with_freqrJ   rK   asi8assert_numpy_array_equalr   r   np_valuesr   shares_memoryrT   _mask_ndarrayr   )r   indexinit_kwargs
index_typerM   s        r   test_ensure_copied_datazBase.test_ensure_copied_data   sv    e[)) 	/"'*K
J8HIJJ 	/ F[F""u':i'G'G#(;K %[[
ELCCtC{CC -- 	D''..99%(CCFem^<== 	+$$T**E
eV,,,e[)) 	XZN
NN+NNF'
FKFSSSSSS}-- 	XD%[[E!!*U["(*K*K!ZHH5HKHHF!&%000%-99 7'(;V^=QRRRRR+M')=&    '(;V^=QRRRRR+M')=&       000'(>@WXXXXX+M*FN,CPV       111'FFFFFFF)%+666ZHH5HKHHF'fmPVWWWWWWr   c                   |j                                          |                                }|j        r
|dk    sJ d S |                    |d                    |                                }|                    d          }t          |t          t          f          s=t          |          t          u rt          |j
        t          j
                  r||k    sJ |j        dk    r||k    sJ d S d S )Nr   TdeeprC   )_engineclear_mappingmemory_usageemptyget_locrI   r   r   r1   r   rE   r~   rv   )r   r   rM   result2result3s        r   test_memory_usagezBase.test_memory_usage   s    ##%%%##%%; 	Q;;;;F 	eAh$$&&$$$$//
 %*m!<== 	$KK5  EK)J)J V####(**W$$$$ +*$$r   c                    t          |t                    rd S |                                }t          j        |                                          }t          j        ||d           d S )NF)check_dtype)rI   r	   argsortr~   arrayrJ   r}   )r   r   rM   rL   s       r   test_argsortzBase.test_argsort  s^    e-.. 	F8E??**,,
#FH%HHHHHHr   c                l   t          j        |          }|                                }t          j        ||           t          j        |d          }|                    d          }t          j        ||           t	          |t
          t          f          rd}t          j        t          |          5  t          j        |d           d d d            n# 1 swxY w Y   d}t          j        t          |          5  t          j        |d	           d d d            d S # 1 swxY w Y   d S d S )
N	mergesort)kind%the 'axis' parameter is not supportedr%   r/   axisz&the 'order' parameter is not supported)ab)order)
r~   r   rJ   r}   rI   r	   r   r(   r)   
ValueError)r   r   rM   rL   r+   s        r   test_numpy_argsortzBase.test_numpy_argsort  s   E""==??
#FH555E444==k=22
#FH555 e.
;<< 	49Cz555 * *
5q))))* * * * * * * * * * * * * * * ;Cz555 4 4
5
33334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4	4 	4s$   8CC"CD''D+.D+c                   d}|                                 }|j        } ||j                            |          |j                  }t          j        |                    |          |           |}t          j        t          |                    } ||j                            |          |j                  }t          j        |                    |          |           d S )Nr0   r8   )
rp   _constructorrw   rh   r9   rJ   rK   r~   arangelen)r   r   repr5   new_index_clsrL   s         r   test_repeatzBase.test_repeat8  s    !!( =!2!23!7!7chGGG
cjjoox888iC!! =!2!23!7!7chGGG
cjjoox88888r   c                "   d}|}|                     |          }t          j        t          j         ||          |           d}t	          j        t          |          5  t          j         ||d           d d d            d S # 1 swxY w Y   d S )Nr0   r   r%   r   r   )rh   rJ   rK   r~   r(   r)   r   )r   r   r   r5   rL   r+   s         r   test_numpy_repeatzBase.test_numpy_repeatD  s    ::c??
biS118<<<5]:S111 	( 	(Ic3Q''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   BBBc                   |}|}t          |t          t          f          r|                    d           }dgt	          |          z  }|                     ||                    }|}t          j        ||           dgdgt	          |dd                    z  z   }t          |j	        g|dd          
                                z   |j                  }|                     ||                    }t          j        ||           d S )NTFr/   rD   )rI   r
   r   r{   r   whererJ   rK   r   	_na_valuetolistrE   )r   listlike_boxr   klassr5   condrM   rL   s           r   
test_wherezBase.test_whereN  s    cM>:;; 	'..&&CvC 55;;''
fh///w$#c!""g,,..#-3qrr7>>+;+;;39MMM55;;''
fh/////r   c                    |dd         }t          |          sd S |dd                             |                    d|d                             sJ d S )Nr/      r   )r   equalsinsert)r   r   rM   s      r   test_insert_basezBase.test_insert_base`  s^    qs5zz 	F QqSz  q%(!;!;<<<<<<<r   c                   t          |          dk    rt          }nt          }t          |          dk    rd}nd}t          j        ||          5  |                    dd           d d d            n# 1 swxY w Y   d                    dd	g          }t          j        t          |          5  |                    t          |          d
z   d
           d d d            n# 1 swxY w Y   t          j        t          |          5  |                    t          |           d
z
  d
           d d d            d S # 1 swxY w Y   d S )Nr   z5index (0|0.5) is out of bounds for axis 0 with size 0zBslice indices must be integers or None or have an __index__ methodr%   g      ?r=   r$   z5index -?\d+ is out of bounds for axis 0 with size \d+zloc must be an integer betweenr/   )r   r*   
IndexErrorr(   r)   r   r'   )r   r   errr+   s       r   test_insert_out_of_boundszBase.test_insert_out_of_boundsi  s    u::>>CCCu::??ICCVC]3c*** 	% 	%LLe$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% hhH0
 
 ]:S111 	, 	,LLUa+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, ]:S111 	- 	-LL#e**q!,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s6   A44A8;A81'C$$C(+C(
(D??EEc                6   t          |          sd S t          |t                    rd S |dd          }|                    d          }|                    |          sJ |j        |j        k    sJ |d d         }|                    d          }|                    |          sJ |j        |j        k    sJ t          |          }d| d| }t          j        t          |          5  |                    |           d d d            d S # 1 swxY w Y   d S )Nr/   r   zindex z' is out of bounds for axis 0 with size r%   )	r   rI   r   deleter   r9   r(   r)   r   )r   r   rL   rM   lengthr+   s         r   test_delete_basezBase.test_delete_base  sk   5zz 	FeZ(( 	F9a}}X&&&&&{hm++++":b!!}}X&&&&&{hm++++UNvNNfNN]:S111 	! 	!LL   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   +DDDc                4   t          |t                    rd S t          |          t          u ot          |j        t
          j                   }|                    |          sJ |                    |                                          sJ |s/|                    |                    t                              sJ |                    t          |                    rJ |                    t          j        |                    rJ t          |t                    sF|sDt          |t                    }|                    |          sJ |                    |          sJ |j        dk    r$|                    t          |                    rJ d S d S )NrD   r/   )rI   r   r1   r   rE   r~   r   rp   astyperC   listr   r   nlevelsr   )r   r   	is_ea_idxsame_valuess       r   test_equalszBase.test_equals  s{   e]++ 	 FKK5(REK1R1R-R	||E"""""||EJJLL))))) 	6<<V 4 455555<<U,,,,,<<00000 %,, 	-Y 	-V444K<<,,,,,%%e,,,,,=A||F5MM22222 22r   c                `   |}t          |          }|dd         }|dd                             |dd                   }|dd         }d}t          j        t          |          5  ||k     d d d            n# 1 swxY w Y   t          j        dg|z            }t          j        dg|dz
  z  dgz             }	t          j        ||k    |           t          j        ||k    |	           t          j        |          }
t          j        |dd                   }t          j        |dd                             |dd                             }t          j        |dd                   }t          j        t          |          5  ||k     d d d            n# 1 swxY w Y   t          j        ||
k    |           t          j        ||k    |	           t          |
          }t          |          }t          |          }t          |          }t          j        t          |          5  ||k     d d d            n# 1 swxY w Y   t          j        ||k    |           t          j        ||k    |	           t          j        t          d	          5  ||k     d d d            n# 1 swxY w Y   t          j        t          d	          5  ||k     d d d            n# 1 swxY w Y   t          j        t          d	          5  ||k     d d d            n# 1 swxY w Y   d
}t          j        t          |          5  ||k     d d d            n# 1 swxY w Y   t          j        t          d	          5  ||k     d d d            n# 1 swxY w Y   t          |t                    svt          j        dgt          |          dz
  z  ddgz             }|d         }t          j        ||k    |           t          j        ||k    t          |                     d S d S )Nr   r   r/   z)Lengths must match|could not be broadcastr%   TFzLengths must matchz3Can only compare identically-labeled Series objectsr0   )r   appendr(   r)   r   r~   r   rJ   r}   r   rI   r   assert_series_equal)r   r   index_anindex_bindex_cindex_dr+   	expected1	expected2array_aarray_barray_carray_dseries_aseries_bseries_cseries_d	expected3items                       r   test_equals_opzBase.test_equals_op  s   LL!B$-!B$-&&wr"u~66!A#,9]:S111 	 	w	 	 	 	 	 	 	 	 	 	 	 	 	 	 	HdVaZ((	HdVq1u-788	
#Gw$6	BBB
#Gw$6	BBB (7##(71R4=))(71R4=//2??@@(71Q3<((]:S111 	 	w	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
#Gw$6	BBB
#Gw$6	BBB '??'??'??'??]:S111 	  	 x	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	#Gx$7CCC
#Gx$7CCC ]:-ABBB 	 	w	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:-ABBB 	  	 x	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 ]:-ABBB 	 	w	 	 	 	 	 	 	 	 	 	 	 	 	 	 	C]:S111 	! 	!  	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!]:-ABBB 	  	 	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  ':.. 	H%CLL1,<!=u!MNNI2;D'4CCC"8t#3VI5F5FGGGGG	H 	Hs   (A;;A?A?F  F$'F$4IIIJ22J69J6K++K/2K/L$$L(+L(MM#&M#NNNc                V    |}d |D             }|                                 |k    sJ d S )Nc                ,    g | ]}t          |          S ru   rk   .0xs     r   
<listcomp>z$Base.test_format.<locals>.<listcomp>  s    (((qCFF(((r   )format)r   r   r5   rL   s       r   test_formatzBase.test_format  s9    ((C(((zz||x''''''r   c                    |                      g           }|                                g k    sJ |                    d          dgk    sJ d S )NTr8    )r   r   )r   	empty_idxs     r   test_format_emptyzBase.test_format_empty  sZ    OOB''	!!R''''T**rd222222r   c                   t          |          dk    rd S |j        t          k    rd S t          |t                    rt          |j                  rd S t          |t                    ri|                    d          }d}t          j	        t          |          5  |                    |d                    d d d            d S # 1 swxY w Y   d S |                    d          }|                    |d                   }t          j        ||           ||usJ d}t          j	        t          |          5  |                    |d         g           d d d            n# 1 swxY w Y   |                    d          }|j        }t           j        |d<    t%          |          |          }d}t          j	        t          |          5  |                    |d         d	
           d d d            n# 1 swxY w Y   t!          j        dgt          |          z  t                    }d|d<   t          j        |j        |           |j        du sJ d S )Nr   Tr   "isna is not defined for MultiIndexr%   z"'value' must be a scalar, passed: r/   zdoes not support 'downcast'infer)downcastFrD   )r   rE   boolrI   r   r   r   rp   r(   r)   r   fillnarJ   rK   r*   r   r~   nanr1   r   r}   _isnanhasnans)r   r   r5   r+   rM   rw   rL   s          r   test_fillnazBase.test_fillna   s    u::??F[D  Fu%%  	'*:5;*G*G  	'Fz** 	'**$*''C6C2#>>> # #

3q6"""# # # # # # # # # # # # # # # # # # **$*''CZZA''F!&#...$$$$6Cy444 % %

CF8$$$% % % % % % % % % % % % % % % **$*''C[FF1I$u++f%%C/C2#>>> 5 5

3q6G
4445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 x#c(( 2$???HHQK'
H===;$&&&&&&s6   CCC:E##E'*E'G99G= G=c                   t          |          dk    rBt          j        |                                t	          j        g t                               d S t          |t                    r`|	                                }d}t          j        t          |          5  |                                 d d d            d S # 1 swxY w Y   d S |j        st          j        |                                t	          j        t          |          t                               t          j        |                                t	          j        t          |          t                               d S t          |          }t          j        |                                |           t          j        |                                |            d S )Nr   rD   r   r%   )r   rJ   r}   r   r~   r   r   rI   r   rp   r(   r)   r   r   zerosnotnaones)r   r   r5   r+   rM   s        r   
test_nullszBase.test_nulls)  s    u::??'

bhr6N6N6NOOOOOz** 	@**,,C6C2#>>>  


                  	@'

bhs5zzQU6V6V6VWWW'rws5zzQU7V7V7VWWWWW%[[F'

f==='w?????s   B>>CCc                >    |}|j         rJ |d d         j         sJ d S Nr   )r   r:   s      r   
test_emptyzBase.test_empty;  s1    92A2w}r   c                ~    |}|j         r1|                    ||          }||k                                    sJ d S d S )N)how)	is_uniquer'   r^   )r   	join_typer   r5   joineds        r   test_join_self_uniquezBase.test_join_self_uniqueA  sR    = 	)XXcyX11F6M&&(((((	) 	)((r   c                d    |}|                     d           }t          j        ||d           d S )Nc                    | S rb   ru   )r   s    r   <lambda>zBase.test_map.<locals>.<lambda>K  s    1 r   equivexact)maprJ   rK   )r   r   r5   rM   s       r   test_mapzBase.test_mapG  s8    %%
fc999999r   mapperc                6    d t          | |          D             S )Nc                    i | ]\  }}||	S ru   ru   )r   eis      r   
<dictcomp>z!Base.<lambda>.<locals>.<dictcomp>R  s    "G"G"GDAq1a"G"G"Gr   )ziprw   r   s     r   r  zBase.<lambda>R  s    "G"GC4F4F"G"G"G r   c                "    t          | |          S rb   )r   r  s     r   r  zBase.<lambda>S  s    &"7"7 r   c                   |}t          |t                    r$t          j        dt	          |                       ||j        |          }|                    |          }t          j        ||d           d }|j	        j
        dk    r|j	        }t          t          j        gt          |          z  |          }|                     |||                    }t          j        ||           d S )Nzskipping tests for r  r  frD   )rI   r	   r(   skipr1   rw   r	  rJ   rK   rE   r   r   r~   r   r   )r   r  r   r5   identityrM   rE   rL   s           r   test_map_dictlikezBase.test_map_dictlikeO  s     c+,, 	;
 K9d3ii99:::6#*c**""
fc9999 9>S  IE"&CHH,E:::#..//
fh/////r   c                    |}|                     t                    }t          d |D             t                    }t	          j        ||           d S )Nc                ,    g | ]}t          |          S ru   r   r   s     r   r   z%Base.test_map_str.<locals>.<listcomp>r  s    ...Q#a&&...r   rD   )r	  rk   r   rC   rJ   rK   )r   r   r5   rM   rL   s        r   test_map_strzBase.test_map_strn  sP    ..#...f===
fh/////r   rp   TFr9   Nr=   orderedc                Z   |}|r|                     |          }t          |          }|                    ||          }t          |||          }t	          j        ||d           t          |                                                                d d         |          }|                    ||          }t          |||          }t	          j        ||d           |du rA|                    d	|          }t          ||
          }t	          j        ||d           d S d S )N)r  )rp   )r9   r  Tr  r   )r9   rE   Fcategoryr8   )renamer   r   r	   rJ   rK   uniquer   )	r   rp   r9   r  r   r5   rE   rM   rL   s	            r   test_astype_categoryzBase.test_astype_categoryu  s<   
  	#**T""C !111E--#CdGDDD
fhd;;;; !!4!4!6!6ss!;WEEE--#Cd%@@@
fhd;;;;eZZ
Z66F'$777H!&($??????	 r   c                h   |                                 }|j        du sJ |d d         }|j        du sJ |                    d|d                   }|j        du sJ |                    dt          j                  }|j        du sJ |                    dt          j                  }|j        du sJ d S )NTr   F)drop_duplicatesr   r   r~   r   )r   r   r   index_empty	index_dupindex_naindex_na_dups          r   test_is_uniquezBase.test_is_unique  s    ,,..$&&&& BQBi$,,,, LLE!H--	"e++++ <<26**!T))))  q"&11%......r   c                    |}t          t          j        |                    }|j         t          t          j        |                    |k    sJ d S rb   )r   gcget_referrersr   )r   r   r   	nrefs_pres       r   test_engine_reference_cyclez Base.test_engine_reference_cycle  sR     (//00	2#E**++y888888r   c                   |}d}t          j        t          |          5  |d d d f          d d d            n# 1 swxY w Y   t          |t                    syt          j        t          |          5  |d          d d d            n# 1 swxY w Y   t          j        t          |          5  |d          d d d            d S # 1 swxY w Y   d S d}t          j        t
          |          5  |d          d d d            n# 1 swxY w Y   t          j        t
          |          5  |d          d d d            d S # 1 swxY w Y   d S )NzMulti-dimensional indexingr%   TFzonly integers, slices)r(   r)   r   rI   r   r   r4   s       r   test_getitem_2d_deprecatedzBase.test_getitem_2d_deprecated  s   *]:S111 	 	4LL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 #z** 	z555  D		              z555  E

                  *Cz555  D		              z555  E

                 sU   9= =4	B		BB/	CC	C	/	DDD*	E  EEc                    |}|                     |d                    |                                }|j        |j        u sJ d S r   )r   rp   _cache)r   r   r5   rp   s       r   test_copy_shares_cachezBase.test_copy_shares_cache  sE    CFxxzz{cj((((((r   c                    |}|                     |d                    |                                }|j        |j        u sJ |                    |j                  }|j        |j        usJ |j        i k    sJ d S r   )r   _viewr1  _shallow_copyrT   )r   r   r5   shallow_copys       r   test_shallow_copy_shares_cachez#Base.test_shallow_copy_shares_cache  s    CFyy{{"cj0000((33"#*4444"b((((((r   c                h   |d d         }t          j        ddt           j        ddg          }t          j        |                    |          |ddg         |ddg         d           t          t          dd	d          t          dd
d          t          j	        t          dd
d          t          dd	d          gd          j
        }t          d          t          d          g}|d         |ddg         |d         |ddg         i}t          j        |                    |          |           d S )N   r/   r0   r   r      )g      ?g       @i        rq   )rz   z
2011-11-01z
2011-12-01)r~   r   r   rJ   assert_dict_equalgroupbyr
   r   ri   NaTrw   r   )r   r   r5   
to_groupbyex_keysrL   s         r   test_index_groupbyzBase.test_index_groupby  s:   2A2Xq!RVQ233

KK
##31v;S!Q[%I%I	
 	
 	
 #r1%%r1%%r1%%r1%% 	
 	
 	
  	 \**Il,C,CDAJQFWQZaVE
S[[44h?????r   c                   |}t          |          }|                    |          }|j        |j        k    sJ t          j        |d |         |d           t          j        ||d          |d           |                    t          t          |                    dz            }t          j        ||d           d S )NT)check_exactr0   )r   r   rE   rJ   rK   taker   range)r   r   r   NrM   alts         r   test_append_preserves_dtypez Base.test_append_preserves_dtype  s    JJe$$|u{****
fRaRj%TBBBB
fQRRj%TBBBBjjeAhh!+,,
fct<<<<<<r   c                   |}|j         j        dv rh| }t          |j         |j                  }t          j        ||           t          |           }t          j        |t          |                     d S |j         j        dk    rd}nd}t          j
        t          |          5  |  d d d            n# 1 swxY w Y   t          j
        t          |          5  t          |            d d d            d S # 1 swxY w Y   d S )N)r  ur8   r  z0ufunc 'invert' not supported for the input typeszbad operandr%   )rE   r   r   rw   r9   rJ   rK   r   r   r(   r)   r*   )r   r   r5   resrL   res2r+   s          r   test_invzBase.test_inv  s   9>Z''$Ccj[sx888H!#x000 3KK<D"4)9)9:::::y~$$H#y444                 y444                   s$   )B99B= B=C==DDc                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S rb   )rJ   assert_produces_warningFutureWarning
is_booleanr:   s      r   test_is_boolean_is_deprecatedz"Base.test_is_boolean_is_deprecated      '66 	 	NN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   >AAc                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S rb   )rJ   rP  rQ  is_floatingr:   s      r   test_is_floating_is_deprecatedz#Base.test_is_floating_is_deprecated      '66 	 	OO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rU  c                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S rb   )rJ   rP  rQ  
is_integerr:   s      r   test_is_integer_is_deprecatedz"Base.test_is_integer_is_deprecated  rT  rU  c                    |}t          |          j         d}t          j        t          |          5  |                                 d d d            d S # 1 swxY w Y   d S )Nz.holds_integer is deprecated. r%   )r1   r2   rJ   rP  rQ  holds_integerr4   s       r   test_holds_integer_deprecatedz"Base.test_holds_integer_deprecated!  s    c#CCC'SAAA 	  	 	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   AAAc                    |}t          j        t          t          |          j         d          5  |                                 d d d            d S # 1 swxY w Y   d S )Nz.is_numeric is deprecated. r%   )rJ   rP  rQ  r1   r2   
is_numericr:   s      r   test_is_numeric_is_deprecatedz"Base.test_is_numeric_is_deprecated(  s    '#YY'DDD
 
 
 	 	 NN		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r-   c                    |}t          j        t          d          5  |                                 d d d            d S # 1 swxY w Y   d S )Nz4Use pandas\.api\.types\.is_categorical_dtype insteadr%   )rJ   rP  rQ  is_categoricalr:   s      r   !test_is_categorical_is_deprecatedz&Base.test_is_categorical_is_deprecated1  s    'I
 
 
 	! 	!    		! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   A  AAc                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S rb   )rJ   rP  rQ  is_intervalr:   s      r   test_is_interval_is_deprecatedz#Base.test_is_interval_is_deprecated:  rY  rU  c                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S rb   )rJ   rP  rQ  	is_objectr:   s      r   test_is_object_is_deprecatedz!Base.test_is_object_is_deprecated@  s    '66 	 	MMOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rU  )r    r   ):r2   
__module____qualname____doc____annotations__r(   fixturer   r"   r,   r6   r;   rN   r\   r`   re   rl   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  markparametrizer  r  r!  r(  arm_slowr-  r/  r2  r7  rB  rI  rN  rS  rX  r\  r_  rb  re  rh  rk  ru   r   r   r   r   "   s          ^< < ^<< < < <  "
 
 
$ $ $2 2 2h) ) )V  4 4 4) ) )6X 6X 6Xp% % %0I I I4 4 42
9 
9 
9( ( (0 0 0$= = =- - -6! ! !.3 3 36<H <H <H|( ( (3 3 3'' '' ''R@ @ @$  ) ) ): : : [GG77	
 0 0 000 0 0 [VdE]33[VdE]33[Yu66@ @ 76 43 43@0/ / /* [9 9 9  () ) )
) 
) 
)@ @ @,= = =  .             ! ! !      r   r   c                      e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zej                            dej        ej        g          d             Zd ZdS )NumericBasezJ
    Base class for numeric index (incl. RangeIndex) sub-class tests.
    c                    | j         }t          ddg|          } ||          }t          j        ddg|j                  }t          j        |j        |           d S )Nr/   r0   rD   )r   r   r~   r   rE   rJ   r}   rT   )r   rE   	index_clsr5   rM   rL   s         r   test_constructor_unwraps_indexz*NumericBase.test_constructor_unwraps_indexL  sa    O	QF%(((38QF#)444
#FL(;;;;;r   c                    d S rb   ru   r   s    r   r   zNumericBase.test_whereT  s    r   c                L    |}|d         }|                     |          du sJ d S )Nr   F)$_can_hold_identifiers_and_holds_name)r   r   r5   keys       r   test_can_hold_identifiersz%NumericBase.test_can_hold_identifiersX  s5    !f77<<EEEEEEr   c                N   | j         } |g |d          }|                                }|j        dk    sJ |                    |          }t          j        | ||d          d           |                    |          }t          j        | ||d          d           d S )NFoo)rE   r9   r8   Tr  )r   viewr9   rJ   rK   )r   rE   rw  r5   idx_views        r   	test_viewzNumericBase.test_view]  s    O	i%e44488::}%%%%88E??
c99XE#B#B#B$OOOO88I&&
c99XE#B#B#B$OOOOOOr   c                    |}t          d |D                       fd|D             }|                                |k    sJ d S )Nc              3  N   K   | ] }t          t          |                    V  !d S rb   )r   rk   r   s     r   	<genexpr>z*NumericBase.test_format.<locals>.<genexpr>m  s.      11CFF111111r   c                T    g | ]$}t          |                                        %S ru   )rk   ljust)r   r   	max_widths     r   r   z+NumericBase.test_format.<locals>.<listcomp>n  s+    999CFFLL++999r   )maxr   )r   r   r5   rL   r  s       @r   r   zNumericBase.test_formatj  s\    11S11111	9999S999zz||x''''''r   c                    d S rb   ru   r   s    r   r\   zNumericBase.test_numeric_compatq  s    r   c                    |}|                     d|d                   }t          |d         gt          |          z   |j                  }t	          j        ||d           d S )Nr   rD   Tr  )r   r   r   rE   rJ   rK   )r   r   r   rM   rL   s        r   test_insert_non_nazNumericBase.test_insert_non_nat  sc     aq**%(d5kk1EEE
fhd;;;;;;r   c                   |}|}|t           j        u rAt          |d         t           j        gt          |dd                    z   t                    }n_t          |d         t
          j        gt          |dd                    z             }|j        j        dk    rt          ||j                  }|	                    d|          }t          j        ||d           d S )Nr   r/   rD   r  Tr  )ri   r?  r   r   rC   r~   r   rE   r   r   rJ   rK   )r   nulls_fixturer   r   na_valrL   rM   s          r   test_insert_nazNumericBase.test_insert_na~  s    RVeAh/$uQRRy//APPPHHeAh/$uQRRy//ABBH{3&& ===a((
fhd;;;;;;r   c                   | j         }|t          u rt          d          }n |t          j        dd                    }t          j        dd          dz  }t	          |t          j                  }|dz  }t          j        ||           d|z  }t          j        ||           t	          |t          j                  }t          j        dd          }||z
  }t          j        ||           t	          | t          j                  }t          j        dd          }||z
  }t          j        ||           d S )Nr9  int64rD   g	@float64)	r   r   r~   r   r   r  rJ   rK   r   )r   rw  r5   arrrL   fidxr   rM   s           r   $test_arithmetic_explicit_conversionsz0NumericBase.test_arithmetic_explicit_conversions  s:    O	
""Q--CC)BIaw77788C i)))C/BJ///Sy
dH---Sy
dH--- BJ///HQi(((
fh///#RZ000HQi(((T
fh/////r   complex_dtypec                v    |                     |          }t          |          t          u r|j        |k    sJ d S rb   )r   r1   r   rE   )r   r  r   rM   s       r   test_astype_to_complexz"NumericBase.test_astype_to_complex  s>    $$]33F||u$$)F)F)F)F)F)Fr   c                    |                      g d|          }|                      g d|          }t          j        ||           d S )N)012rD   )r   r/   r0   )r   rJ   rK   )r   rE   rM   rL   s       r   test_cast_stringzNumericBase.test_cast_string  sM    >>??999E?::
fh/////r   N)r2   rl  rm  rn  rx  r   r}  r  r   r\   r  r  r  r(   rq  rr  r~   	complex64
complex128r  r  ru   r   r   ru  ru  G  s         < < <  F F F
P P P( ( (  < < << < < 0 0 08 [_r|R].KLLG G MLG
0 0 0 0 0r   ru  )!
__future__r   r   r*  numpyr~   r(   pandas._libs.tslibsr   pandas.core.dtypes.commonr   r   pandas.core.dtypes.dtypesr   pandasri   r	   r
   r   r   r   r   r   r   r   r   pandas._testing_testingrJ   pandas.core.arraysr   r   ru  ru   r   r   <module>r     s   " " " " " "       				      ) ) ) ) ) )        7 6 6 6 6 6                                  . . . . . .b b b b b b b bJl0 l0 l0 l0 l0$ l0 l0 l0 l0 l0r   