
    bMh(                        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mZmZmZ d dlmZ d dl m!c m"Z# d dl$m%Z%  G d	 d
          Z& G d d          Z'dS )    )annotations)datetimeN)	Timestamp)is_integer_dtypeis_numeric_dtype)CategoricalDtype)CategoricalIndexDatetimeIndexDatetimeTZDtypeIndexIntervalIndex
MultiIndexPeriodIndex
RangeIndexSeriesStringDtypeTimedeltaIndexisnaperiod_range)BaseMaskedArrayc                     e Zd Z ej         eddd           e ej        dej	                             e ej        dej
                             e ej        dej                             e eddd          ej                   e eddd          ej                   e eddd          ej                   e eddd          ej                   e ed                     eg d           ed	dd
           eg ddd
           eg ddd
           ej         ed          d          g          d             Zd Zd Zd Zd Zd Zd Zd Zd Zej         !                    d          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         !                    d          d*                         Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4ej         5                    d3d4 d5 g          ej         !                    d          d6                         Z6d7 Z7ej         5                    d8d9d:g          ej         5                    d;d<d=g          ej         5                    d>d9d:g          d?                                     Z8d@ Z9ej         j:        dA             Z;dB Z<dC Z=dD Z>dE Z?dF Z@dG ZAdH ZBdI ZCdJ ZDdK ZEdL ZFdM ZGdN ZHdO ZId<S )PTestBaser         startstopstep   dtypeabcde)r   a   br   c20130101D)periodsfreq)z0 days 01:00:00z1 days 01:00:00z2 days 01:00:00z3 days 01:00:00z4 days 01:00:00ztimedelta64[ns])r!   r*   )z
2013-01-01z
2013-01-02z
2013-01-03z
2013-01-04z
2013-01-05zdatetime64[ns]   right)closedparamsc                    |j         S Nparamselfrequests     b/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/indexes/test_old_base.pysimple_indexzTestBase.simple_index'   s    B }    c                   t          |t                    rt          j        d           d                    g d          }t          j        t          |          5   t          |                       d d d            d S # 1 swxY w Y   d S )Nz#RangeIndex() is a valid constructor|)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)
isinstancer   pytestskipjoinraises	TypeErrortype)r5   r8   msgs      r7   test_pickle_compat_constructionz(TestBase.test_pickle_compat_constructionJ   s    lJ// 	?K=>>>hh	 	 	
 
 ]9C000 	! 	!D   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   BBBc                   t          |t          t          t          f          rt	          j        d           |}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"Tested in test_ops/test_arithmeticz\This method is only implemented for DatetimeIndex, PeriodIndex and TimedeltaIndex; Got type r<   r$   r   )r>   r
   r   r   r?   r@   rD   __name__rB   NotImplementedErrorshiftr5   r8   idxrE   s       r7   
test_shiftzTestBase.test_shift]   sX   l]NK$PQQ 	>K<====(,S		(:= = 	 ].c::: 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	].c::: 	 	IIaOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s$   +BBB3CCC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?   rB   rC   rD   r5   r8   rL   s      r7    test_constructor_name_unhashablez)TestBase.test_constructor_name_unhashablek   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barrO   ))rT   one)rT   two)rU   rV   )bazrW   )quxrV   )rY   rW   objectr    )namesAB)copyr>   r   rP   r   tmassert_index_equalr[   )r5   r8   expectedresults       r7   test_create_index_existing_namez(TestBase.test_create_index_existing_namer   sh     $$&&(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!   '
 
 
 *      r9   c                :   |}t          |t                    rJ t          |          t          u rt	          j        d           t          |j                  st          |t                    rt	          j        d           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 )NzNot applicable for IndexTested elsewhere.r;   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//)r>   r   rD   r   r?   r@   r   r!   r   _datarH   rA   rB   rC   replace)	r5   r8   rL   typclslmsgrmsgdiv_errfloordiv_errs	            r7   test_numeric_compatzTestBase.test_numeric_compat   sD    c:.....99K2333L.// 	-:.4
 4
 	- K+,,,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   +C==DDEEEF%%F),F)!G33G7:G7/III=JJJc                ~   |j         t          dfv rt          j        d           |}|j         j        dv r|                                |j                                        k    sJ |                                |                                                                k    sJ |                                |j                                        k    sJ |                                |                                                                k    sJ d S d}t          |t                    rd}t          j        t          |          5  |                                 d d d            n# 1 swxY w Y   t          j        t          |          5  |                                 d d d            d S # 1 swxY w Y   d S )Nstringre   iufcbmzcannot perform (any|all)zP'IntervalArray' with dtype interval\[.*\] does not support reduction '(any|all)'r<   )r!   rZ   r?   r@   kindall_values	to_seriesanyr>   r   rB   rC   rK   s       r7   test_logical_compatzTestBase.test_logical_compat   s   &(!333K+,,,9>X%%7799 1 111117799 3 3 5 555557799 1 111117799 3 3 5 5555555,C#}-- 8  y444  			              y444  			                 s$   	E**E.1E.F22F69F6c                    t          |t                    r)t          j        dt	          |          j                    |}t          j        t          t          |                    |           d S )NNot a valid repr for )
r>   r   r?   r@   rD   rH   r_   r`   evalreprrQ   s      r7   test_repr_roundtripzTestBase.test_repr_roundtrip   sc    lM22 	OKM\0B0B0KMMNNN
d499oos33333r9   c                R   t          |t                    r)t          j        dt	          |          j                    |}|                    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 )Nr}   2   zdisplay.max_seq_itemsz...)r>   r   r?   r@   rD   rH   repeatpdoption_contextr   strrQ   s      r7   test_repr_max_seq_item_settingz'TestBase.test_repr_max_seq_item_setting   s    lM22 	OKM\0B0B0KMMNNNjjnn6== 	) 	)IIIC(((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   +#BB #B z3ignore:PeriodDtype\[B\] is deprecated:FutureWarningc                   i }t          |t                    r|j        |d<   nZt          |t          t          t
          f          rt          j        d           n#|j        t          k    r|j
        dv r
|j        |d<   t          |          } ||j        fddi|}t          |j        t                    r-|                    d                              |j                  }t          |t"          t$          f          r|                    d           }t)          j        ||           t          |t                    rhd}t)          j        t.          |	          5   |d|j        d
d|}d d d            n# 1 swxY w Y   t)          j        |j        |j        d           d S t          |t4                    rd S t          |          t6          u rt          |j        t8          j                  s ||j        fdd
i|}t)          j        ||           t          |j        t<                    rt9          j        |j        j         |j        j                   sJ t)          j        |j        j         |j        j         d           t9          j        |j        j!        |j        j!                  sJ t)          j        |j        j!        |j        j!        d           d S t          |j        tD                    rh|j        j#        dk    rXt9          j        |j        j$        |j        j$                  sJ t)          j        |j        j$        |j        j$        d           d S t          |j        tD                    r3|j        j#        dk    r#t)          j        |j        |j                  sJ d S tK          |j                   ||j        fdd
i|}t)          j        |j        |j        d           d S )Nr*   zaRangeIndex cannot be initialized from data, MultiIndex and CategoricalIndex are tested separately)booleanrt   r!   r^   TUTCz2The 'ordinal' keyword in PeriodIndex is deprecatedr<   F)ordinalr^   same)
check_samepythonpyarrow )&r>   r   r*   r   r   r	   r?   r@   r!   rZ   inferred_typerD   valuesr   tz_localize
tz_converttzr
   r   
_with_freqr_   r`   assert_produces_warningFutureWarningasi8assert_numpy_array_equalr   r   nprx   r   shares_memoryrj   _maskr   storage_ndarrayrI   )r5   indexinit_kwargs
index_typerb   depr_msgs         r7   test_ensure_copied_dataz TestBase.test_ensure_copied_data   sA    e[)) 		/"'*K
J8HIJJ 	/KH    [F""u':>S'S'S#(;K %[[
ELCCtC{CCek?33 	D''..99%(CCFem^<== 	+$$T**E
eV,,,e[)) &	XKH+MJJJ S S#REJURRkRRS S S S S S S S S S S S S S S'
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')=&      5;4479>9LPX9X9X'(>@WXXXXX+M*FN,CPV      5;447K'944'FFFFFFF)%+666ZHH5HKHHF'fmPVWWWWWWs   E88E<?E<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deeprZ   )_engineclear_mappingmemory_usageemptyget_locr>   r   r   rD   r   r!   r   r   )r5   r   rb   result2result3s        r7   test_memory_usagezTestBase.test_memory_usage;  s    ##%%%##%%; 	Q;;;;F 	eAh$$&&$$$$//
 %*m!<== 	$KK5  EK)J)J V####(**W$$$$ +*$$r9   c                $   t          |t                    r)t          j        t	          |           j         d           |                                }t          j        |                                          }t          j
        ||d           d S )Nz separately testedF)check_dtype)r>   r	   r?   r@   rD   rH   argsortr   arrayr_   r   )r5   r   rb   ra   s       r7   test_argsortzTestBase.test_argsortS  s|    e-.. 	DK4::.BBBCCC8E??**,,
#FH%HHHHHHr9   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)rv   %the 'axis' parameter is not supportedr<   r$   axisz&the 'order' parameter is not supported)r#   r%   )order)
r   r   r_   r   r>   r	   r   r?   rB   
ValueError)r5   r   rb   ra   rE   s        r7   test_numpy_argsortzTestBase.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 )Nr   rO   )
r^   _constructorr   r   rP   r_   r`   r   arangelen)r5   r8   reprL   new_index_clsra   s         r7   test_repeatzTestBase.test_repeatt  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8r9   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 )Nr   r   r<   r   r   )r   r_   r`   r   r?   rB   r   )r5   r8   r   rL   ra   rE   s         r7   test_numpy_repeatzTestBase.test_numpy_repeat  s    ::c??
biS118<<<5]:S111 	( 	(Ic3Q''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   BBBc                   t          |t          t          f          st          |j                  rt          j        d           |}|}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 )Nre   TFr$   r    )r>   r   r   r   r!   r?   r@   r
   r   r   r   wherer_   r`   r   	_na_valuetolist)r5   listlike_boxr8   klassrL   condrb   ra   s           r7   
test_wherezTestBase.test_where  s=   l]K$@AA 	-EUF
 F
 	- K+,,,cM>:;; 	'..&&CvC 55;;''
fh///w$#c!""g,,..#-3qrr7>>+;+;;39MMM55;;''
fh/////r9   c                ~   |dd         }t          |          st          j        d           d }|j        t          k    r|j        dk    rt          }d}t          j        ||          5  |	                    d|d                   }d d d            n# 1 swxY w Y   |dd         
                    |          sJ d S )Nr$      Not applicable for empty indexr   z<The behavior of Index.insert with object-dtype is deprecatedr<   r   )r   r?   r@   r!   rZ   r   r   r_   r   insertequals)r5   r   trimmedwarnrE   rb   s         r7   test_insert_basezTestBase.test_insert_base  s   !*5zz 	:K8999 ;&  U%8I%E%E DL'C888 	1 	1^^AuQx00F	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1QqSz  (((((((s   *BBBc                   t          |          dk    rt          }nt          }t          |          dk    rd}nd}|r|j        dk    s|j        dk    r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__ methodrt   categoryzloc must be an integer betweenr<   g      ?rT   r;   z5index -?\d+ is out of bounds for axis 0 with size \d+r$   )r   rC   
IndexErrorr!   r?   rB   r   rA   )r5   r   using_infer_stringerrrE   s        r7   test_insert_out_of_boundsz"TestBase.test_insert_out_of_bounds  s#    u::>>CCCu::??ICCVC 	3K8##u{j'@'@2C]3c*** 	% 	%LLe$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% hhH0
 
 ]:S111 	, 	,LLUa+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, ]:S111 	- 	-LL#e**q!,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s6   +BBB'C>>DD$(EE Ec                   t          |          st          j        d           t          |t                    r)t          j        t          |           j         d           |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    tested elsewherer$   r   zindex z' is out of bounds for axis 0 with size r<   )r   r?   r@   r>   r   rD   rH   deleter   rP   rB   r   )r5   r   ra   rb   lengthrE   s         r7   test_delete_basezTestBase.test_delete_base  s   5zz 	:K8999eZ(( 	CK4::.AAABBB9a}}X&&&&&{hm++++":b!!}}X&&&&&{hm++++UNvNNfNN]:S111 	! 	!LL   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   $EEEz$ignore:Dtype inference:FutureWarningc                   t          |t                    r)t          j        t	          |          j         d           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 )Nr   r    r$   )r>   r   r?   r@   rD   rH   r   r!   r   r   r^   astyperZ   listr   r   nlevelsr   )r5   r   	is_ea_idxsame_valuess       r7   test_equalszTestBase.test_equals  s    e]++ 	DK4;;/BBBCCC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2r9   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 objectsr   )r   appendr?   rB   r   r   r   r_   r   r   r>   r   assert_series_equal)r5   r8   index_anindex_bindex_cindex_drE   	expected1	expected2array_aarray_barray_carray_dseries_aseries_bseries_cseries_d	expected3items                       r7   test_equals_opzTestBase.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                >   t          |j                  st          |t                    rt	          j        d           |}d |D             }d}t          j        t          |          5  |	                                |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nre   c                ,    g | ]}t          |          S r   r   .0xs     r7   
<listcomp>z(TestBase.test_format.<locals>.<listcomp>H  s    (((qCFF(((r9   Index\.format is deprecatedr<   )
r   r!   r>   r
   r?   r@   r_   r   r   format)r5   r8   rL   ra   rE   s        r7   test_formatzTestBase.test_formatA  s    L.// 	-:-4
 4
 	- K+,,,((C(((,'SAAA 	, 	,::<<8+++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   )BBBc                   t          |t          t          f          rt          j        d            t          |          g           }d}t          j        t          |          5  |	                                g k    sJ 	 d d d            n# 1 swxY w Y   t          j        t          |          5  |	                    d          dgk    sJ 	 d d d            d S # 1 swxY w Y   d S )NTested elsewherer  r<   TrO    )
r>   r   r   r?   r@   rD   r_   r   r   r  )r5   r8   	empty_idxrE   s       r7   test_format_emptyzTestBase.test_format_emptyM  sr   l[*$=>> 	,K*+++&D&&r**	,'SAAA 	, 	,##%%+++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,'SAAA 	7 	7###..2$66666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s$   &BBB4C  C$'C$c                   t          |          dk    rt          j        d           d S |j        t          k    rt          j        |j         d           d S t          |t                    r2t          |j                  rt          j        d|j                    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}d}t          j        t*          |          5  t          j
        t          |          5  |                    |d         d           d d d            n# 1 swxY w Y   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   zNot relevant for empty indexz cannot hold NAszNot relevant for Index with Tr   "isna is not defined for MultiIndexr<   z"'value' must be a scalar, passed: r$   zdoes not support 'downcast'z7The 'downcast' keyword in .*Index\.fillna is deprecatedinfer)downcastFr    )r   r?   r@   r!   boolr>   r   r   r   r^   rB   rI   fillnar_   r`   rC   rx   r   nanrD   r   r   r   r   _isnanhasnans)r5   r   rL   rE   rb   r   msg2ra   s           r7   test_fillnazTestBase.test_fillnaX  s   u::??K677777[D  K5;88899999u%% "	'*:5;*G*G "	'KDu{DDEEEEEz**  	'**$*''C6C2#>>> # #

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

CF8$$$% % % % % % % % % % % % % % % **$*''C[FF1I$u++f%%C/CMD+MFFF 9 9]#6cBBB 9 9JJs1vJ8889 9 9 9 9 9 9 9 9 9 9 9 9 9 99 9 9 9 9 9 9 9 9 9 9 9 9 9 9
 x#c(( 2$???HHQK'
H===;$&&&&&&sZ   'DDDF//F36F3I:9I#I:#I'	'I:*I'	+I::I>I>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   r    r  r<   )r   r_   r   r   r   r   r  r>   r   r^   r?   rB   rI   r  zerosnotnaones)r5   r   rL   rE   rb   s        r7   
test_nullszTestBase.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   rQ   s      r7   
test_emptyzTestBase.test_empty  s1    92A2w}r9   c                    |}|j         rJ|                    ||          }|}|dk    rt          j        |          }t	          j        ||           d S d S )N)howouter)	is_uniquerA   algos	safe_sortr_   r`   )r5   	join_typer8   rL   joinedra   s         r7   test_join_self_uniquezTestBase.test_join_self_unique  sh    = 	4XXcyX11F#HG## ?844!&(33333	4 	4r9   c                    t          |t          t          f          rt          j        d           |}|                    d           }t          j        ||d           d S )Nre   c                    | S r1   r   )r  s    r7   <lambda>z#TestBase.test_map.<locals>.<lambda>  s    1 r9   equivexact)r>   r   r   r?   r@   mapr_   r`   )r5   r8   rL   rb   s       r7   test_mapzTestBase.test_map  s`    l^[$ABB 	-K+,,,%%
fc999999r9   mapperc                6    d t          | |          D             S )Nc                    i | ]\  }}||	S r   r   )r  eis      r7   
<dictcomp>z%TestBase.<lambda>.<locals>.<dictcomp>  s    "G"G"GDAq1a"G"G"Gr9   )zipr   r   s     r7   r,  zTestBase.<lambda>  s    "G"GC4F4F"G"G"G r9   c                "    t          | |          S r1   )r   r9  s     r7   r,  zTestBase.<lambda>  s    &"7"7 r9   c                   |}t          |t          t          t          f          rt	          j        d            ||j        |          }|                    |          }t          j	        ||d           d }|j
        j        dk    r|j
        }t          t          j        gt          |          z  |          }|                     |||                    }t          j	        ||           d S )Nre   r-  r.  fr    )r>   r
   r   r   r?   r@   r   r0  r_   r`   r!   rv   r   r   r  r   )	r5   r2  r8   r6   rL   identityrb   r!   ra   s	            r7   test_map_dictlikezTestBase.test_map_dictlike  s     cM>;GHH 	-K+,,,6#*c**""
fc9999 9>S  IE"&CHH,E:::#..//
fh/////r9   c                    t          |t                    rt          j        d           |}|                    t
                    }t          d |D                       }t          j        ||           d S )NzSee test_map.pyc                ,    g | ]}t          |          S r   r  r  s     r7   r  z)TestBase.test_map_str.<locals>.<listcomp>  s    ...Q#a&&...r9   )	r>   r	   r?   r@   r0  r   r   r_   r`   )r5   r8   rL   rb   ra   s        r7   test_map_strzTestBase.test_map_str  so    l$455 	+K)***..#...//
fh/////r9   r^   TFrP   NrT   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)rB  )r^   )rP   rB  Tr.  r   )rP   r!   Fr   rO   )renamer   r   r	   r_   r`   uniquer   )	r5   r^   rP   rB  r8   rL   r!   rb   ra   s	            r7   test_astype_categoryzTestBase.test_astype_category  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!&($??????	 r9   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  )r5   r8   r   index_empty	index_dupindex_naindex_na_dups          r7   test_is_uniquezTestBase.test_is_unique  s    ,,..$&&&& BQBi$,,,, LLE!H--	"e++++ <<26**!T))))  q"&11%......r9   c                ~    |                                 }t          j        |          }|j         ~ |            J d S r1   )r^   weakrefrefr   )r5   r8   r   rP  s       r7   test_engine_reference_cyclez$TestBase.test_engine_reference_cycle  sA     !!##k%  suu}}}}}r9   c                   t          |t                    rt          j        d           |}d}t          j        t
          t          f|          5  |d d d f          d d d            n# 1 swxY w Y   t          |t                    st          j        t
          t          f|          5  |d          d d d            n# 1 swxY w Y   t          j        t
          t          f|          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 )Nr
  z(Multi-dimensional indexing|too many|onlyr<   TFzonly integers, slices)r>   r   r?   r@   rB   r   r   r   rK   s       r7   test_getitem_2d_deprecatedz#TestBase.test_getitem_2d_deprecated  s   lM22 	,K*+++8]J
33??? 	 	4LL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 #z** 	
J7sCCC  D		              
J7sCCC  E

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

                 sZ   A))A-0A-+	C  CC-	DD
D-	EE	E(	E>>FFc                    |}|                     |d                    |                                }|j        |j        u sJ d S r  )r   r^   _cache)r5   r8   rL   r^   s       r7   test_copy_shares_cachezTestBase.test_copy_shares_cache!  sE    CFxxzz{cj((((((r9   c                    |}|                     |d                    |                                }|j        |j        u sJ |                    |j                  }|j        |j        usJ |j        i k    sJ d S r  )r   _viewrU  _shallow_copyrj   )r5   r8   rL   shallow_copys       r7   test_shallow_copy_shares_cachez'TestBase.test_shallow_copy_shares_cache)  s    CFyy{{"cj0000((33"#*4444"b((((((r9   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 )Nr   r$   r   r   r      )g      ?g       @i  r+      r   )r   z
2011-11-01z
2011-12-01)r   r   r  r_   assert_dict_equalgroupbyr
   r   r   NaTr   r   )r5   r8   rL   
to_groupbyex_keysra   s         r7   test_index_groupbyzTestBase.test_index_groupby5  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?????r9   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_exactr   )r   r   r!   r_   r`   taker   range)r5   r8   r   Nrb   alts         r7   test_append_preserves_dtypez$TestBase.test_append_preserves_dtypeK  s    JJe$$|u{****
fRaRj%TBBBB
fQRRj%TBBBBjjeAhh!+,,
fct<<<<<<r9   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)r6  urO   r<  z0ufunc 'invert' not supported for the input typesz8bad operand|__invert__ is not supported for string dtyper<   )r!   rv   r   r   rP   r_   r`   r   r   r?   rB   rC   )r5   r8   r   rL   resra   res2rE   s           r7   test_invzTestBase.test_invX  s   9>Z''$Ccj[sx888H!#x000 3KK<D"4)9)9:::::y~$$HP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 r1   )r_   r   r   
is_booleanrQ   s      r7   test_is_boolean_is_deprecatedz&TestBase.test_is_boolean_is_deprecatedo      '66 	 	NN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   >AAc                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S r1   )r_   r   r   is_floatingrQ   s      r7   test_is_floating_is_deprecatedz'TestBase.test_is_floating_is_deprecatedu      '66 	 	OO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	ru  c                    |}t          j        t                    5  |                                 d d d            d S # 1 swxY w Y   d S r1   )r_   r   r   
is_integerrQ   s      r7   test_is_integer_is_deprecatedz&TestBase.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<   )rD   rH   r_   r   r   holds_integerrK   s       r7   test_holds_integer_deprecatedz&TestBase.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<   )r_   r   r   rD   rH   
is_numericrQ   s      r7   test_is_numeric_is_deprecatedz&TestBase.test_is_numeric_is_deprecated  s    '#YY'DDD
 
 
 	 	 NN		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAA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<   )r_   r   r   is_categoricalrQ   s      r7   !test_is_categorical_is_deprecatedz*TestBase.test_is_categorical_is_deprecated  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 r1   )r_   r   r   is_intervalrQ   s      r7   test_is_interval_is_deprecatedz'TestBase.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 r1   )r_   r   r   	is_objectrQ   s      r7   test_is_object_is_deprecatedz%TestBase.test_is_object_is_deprecated  s    '66 	 	MMOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	ru  )JrH   
__module____qualname__r?   fixturer   r   r   r   float64float32uint64rh  int64int32int16int8r   r   r   r
   r   from_breaksr8   rF   rM   rR   rc   rr   r{   r   r   markfilterwarningsr   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r   r)  r1  parametrizer>  rA  rF  rM  arm_slowrQ  rS  rV  r[  rd  rk  rp  rs  rx  r|  r  r  r  r  r  r   r9   r7   r   r   &   s       V^JQRa000E)")ARZ00011E)")ARZ00011E)")ARY///00E%%2q//222E%%2q//222E%%2q//222E%%2q//111E$$w--  E***++LQS999N   (
 
 
 MVVV&  
 &M%eeBii@@@9
  @ A @! ! !&  $ $ $2 2 2h- - -^  *4 4 4) ) ) [ VWW>X >X XW>X@% % %0I I I4 4 42
9 
9 
9( ( (0 0 0,) ) ) - - -B! ! !. [ GHH[ VWW3 3 XW IH32<H <H <H|
, 
, 
,	7 	7 	7(' (' ('T@ @ @$  4 4 4: : : [GG77	
  [ VWW0 0 XW 0(0 0 0 [VdE]33[VdE]33[Yu66@ @ 76 43 43@0/ / /* [    ,) ) )
) 
) 
)@ @ @,= = =  .             ! ! !      r9   r   c                     e Zd Z ej         eddd           e ej        dej	                             e ej        dej
                             e ej        dej                             e eddd          ej                   e eddd          ej                   e eddd          ej                   e eddd          ej                  g          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 )TestNumericBaser   r   r   r   r   r    r.   c                    |j         S r1   r2   r4   s     r7   r8   zTestNumericBase.simple_index  s     }r9   c                .   t          |t                    rt          j        d           t	          |          }|j        }t          ddg|          } ||          }t          j        ddg|j                  }t          j
        |j        |           d S )Nre   r$   r   r    )r>   r   r?   r@   rD   r!   r   r   r   r_   r   rj   )r5   r8   	index_clsr!   rL   rb   ra   s          r7   test_constructor_unwraps_indexz.TestNumericBase.test_constructor_unwraps_index  s    lJ// 	-K+,,,&&	"QF%(((38QF#)444
#FL(;;;;;r9   c                L    |}|d         }|                     |          du sJ d S )Nr   F)$_can_hold_identifiers_and_holds_name)r5   r8   rL   keys       r7   test_can_hold_identifiersz)TestNumericBase.test_can_hold_identifiers  s5    !f77<<EEEEEEr9   c                (   t          |t                    rt          j        d           t	          |          }|j        } |g |d          }|                                }|j        dk    sJ |                    |          }t          j	        | ||d          d           d}t          j
        t          |          5  |                    |          }d d d            n# 1 swxY w Y   t          j	        | ||d          d           d S )	Nre   Foo)r!   rP   rO   Tr.  z,Passing a type in .*Index.view is deprecatedr<   )r>   r   r?   r@   rD   r!   viewrP   r_   r`   r   r   )r5   r8   r  r!   rL   idx_viewrE   s          r7   	test_viewzTestNumericBase.test_view  sT   lJ// 	-K+,,,&&	"i%e44488::}%%%%88E??
c99XE#B#B#B$OOOO<'SAAA 	+ 	+xx	**H	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+
c99XE#B#B#B$OOOOOOs   C%%C),C)c                N   t          |t                    rt          j        d           |}t	          d |D                       fd|D             }d}t          j        t          |          5  |                                |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr
  c              3  N   K   | ] }t          t          |                    V  !d S r1   )r   r   r  s     r7   	<genexpr>z.TestNumericBase.test_format.<locals>.<genexpr>  s.      11CFF111111r9   c                T    g | ]$}t          |                                        %S r   )r   ljust)r  r  	max_widths     r7   r  z/TestNumericBase.test_format.<locals>.<listcomp>  s+    999CFFLL++999r9   r  r<   )	r>   r
   r?   r@   maxr_   r   r   r  )r5   r8   rL   ra   rE   r  s        @r7   r  zTestNumericBase.test_format  s    lM22 	,K*+++11S11111	9999S999,'SAAA 	, 	,::<<8+++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   1BB!Bc                    |}|                     d|d                   }t          |d         gt          |          z   |j                  }t	          j        ||d           d S )Nr   r    Tr.  )r   r   r   r!   r_   r`   )r5   r8   r   rb   ra   s        r7   test_insert_non_naz"TestNumericBase.test_insert_non_na  sc     aq**%(d5kk1EEE
fhd;;;;;;r9   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$   r    r<  Tr.  )r   ra  r   r   rZ   r   r  r!   rv   r   r_   r`   )r5   nulls_fixturer8   r   na_valra   rb   s          r7   test_insert_nazTestNumericBase.test_insert_na  s    RVeAh/$uQRRy//APPPHHeAh/$uQRRy//ABBH{3&& ===a((
fhd;;;;;;r9   c                   t          |          }|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 )Nr   r  r    g	@r  )	rD   r   r   r   r   r  r_   r`   r  )	r5   r8   r  rL   arrra   fidxr#   rb   s	            r7   $test_arithmetic_explicit_conversionsz4TestNumericBase.test_arithmetic_explicit_conversions  s@    &&	
""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/////r9   complex_dtypec                v    |                     |          }t          |          t          u r|j        |k    sJ d S r1   )r   rD   r   r!   )r5   r  r8   rb   s       r7   test_astype_to_complexz&TestNumericBase.test_astype_to_complex  s>    $$]33F||u$$)F)F)F)F)F)Fr9   c                   t          |t                    rt          j        d            t	          |          g d|j                  } t	          |          g d|j                  }t          j        ||           d S )Nz.casting of strings not relevant for RangeIndex)012r    )r   r$   r   )r>   r   r?   r@   rD   r!   r_   r`   )r5   r8   rb   ra   s       r7   test_cast_stringz TestNumericBase.test_cast_string   s    lJ// 	JKHIII#l##OOO<;MNNN%4%%iii|7IJJJ
fh/////r9   N)rH   r  r  r?   r  r   r   r   r   r  r  r  rh  r  r  r  r  r8   r  r  r  r  r  r  r  r  r  	complex64
complex128r  r  r   r9   r7   r  r    s       V^JQRa000E)")ARZ00011E)")ARZ00011E)")ARY///00E%%2q//222E%%2q//222E%%2q//222E%%2q//111	
    	< 	< 	<F F F
P P P$	, 	, 	,< < << < < 0 0 08 [_r|R].KLLG G MLG
0 0 0 0 0r9   r  )(
__future__r   r   rO  numpyr   r?   pandas._libs.tslibsr   pandas.core.dtypes.commonr   r   pandas.core.dtypes.dtypesr   pandasr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   pandas._testing_testingr_   pandas.core.algorithmscore
algorithmsr%  pandas.core.arraysr   r   r  r   r9   r7   <module>r     s   " " " " " "             ) ) ) ) ) )        7 6 6 6 6 6                                        & & & & & & & & & . . . . . .~ ~ ~ ~ ~ ~ ~ ~B~0 ~0 ~0 ~0 ~0 ~0 ~0 ~0 ~0 ~0r9   