
    Oh                       d dl mZ d dlmZmZ d dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlZd dlmZ  ej$                  dd      d	        Z G d
 d      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )annotations)datetime	timedeltaN)IS64is_platform_windows)np_version_gt2Tclass)autousescopec              #  ^   K    j                   }t        j                  |j                  |j                  |j
                  g      } fd} j                  j                  }|j                  s|j                  rd  y |D ]%  } ||      rt        d|j                   d|        d  y w)Nc                    | \  j                   j                  j                  }t        fd|D              S )Nc              3  z   K   | ]2  }|j                   v xr |j                   v xr |j                   v  4 y wNname).0xdtypeklassmethods     k/var/www/html/diagnosisapp-backend/venv/lib/python3.12/site-packages/pandas/tests/indexing/test_coercion.py	<genexpr>z<check_comprehensiveness.<locals>.has_test.<locals>.<genexpr>$   s<      
IJEQVVODDFaff4DD
s   8;)nodesessionitemsany)combo	cls_funcsr   r   r   requests     @@@r   has_testz)check_comprehensiveness.<locals>.has_test!   s>    $ufLL((..	 
NW
 
 	
    ztest method is not defined: z, )cls	itertoolsproductklassesdtypesr   configoptionlfkeywordAssertionError__name__)r   r"   combosr    optsr   s   `     r   check_comprehensivenessr/      s      ++Cs{{CJJEF
 >>  Dww$,, 	  	EE?$23<<.5'J 	 	s   BB-!B-c                  ,    e Zd ZddgZg dZed        Zy)CoercionBaseindexseries)	objectint64float64
complex128bool
datetime64datetime64tztimedelta64periodc                    t        |       r   NotImplementedErrorselfs    r   r   zCoercionBase.methodF   s    !$''r!   N)r,   
__module____qualname__r%   r&   propertyr    r!   r   r1   r1   8   s'    !G
F ( (r!   r1   c                  Z   e Zd ZU dZg Zded<   d Zd Zej                  j                  ddefdefd	efg      d
        Zej                  j                  ddej                  fd	ej                   fdefg      d        Zej                  j                  ddej                   fdej                   fdefg      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zej                  j'                  d      d        Zy)TestSetitemCoercionsetitemz	list[str]r%   c                    t        j                  ddg      }t        |j                        |d d  t        j                  ddg      }t	        j
                  ||       y )Na   )pdSerieslistvaluestmassert_series_equal)rA   serexpecteds      r   0test_setitem_series_no_coercion_from_values_listzDTestSetitemCoercion.test_setitem_series_no_coercion_from_values_listR   sH    iia!cjj!A99c1X&
sH-r!   c                   |j                         }d||<   t        j                  g d|      }t        j                  ||       |j
                  j                  |k(  sJ |j                         }d|j                  |<   t        j                  g d|      }t        j                  ||       |j
                  j                  |k(  sJ y)z-test index's coercion triggered by assign key   )rK            rV   r2   N)copyrL   rM   rP   rQ   r2   r   loc)rA   original_seriesloc_keyexpected_indexexpected_dtypetempexps          r    _assert_setitem_index_conversionz4TestSetitemCoercion._assert_setitem_index_conversion[   s     ##% Wii~>
tS)zz>111##%ii~>
tS)zz>111r!   zval,exp_dtyper   rV   皙?c                ,   t        j                  g dt        j                  t        d      t                    }|j
                  j                  t        k(  sJ |t        u r^|j                         }d}d}t        j                  ||      5  t        j                  t        |      5  d|d<   d d d        d d d        y t        j                  t        d      |gz   t              }| j                  ||||       y # 1 sw Y   OxY w# 1 sw Y   y xY w)	NrK   rW   rX   rY   abcdr   rZ   z;Series.__setitem__ treating keys as positions is deprecatedz/index 5 is out of bounds for axis 0 with size 4matchrV   )rL   rM   IndexrN   r4   r2   r   
IndexErrorr[   pytestraisesrP   assert_produces_warningFutureWarningrc   )rA   val	exp_dtypeobjra   warn_msgmsg	exp_indexs           r   test_setitem_index_objectz-TestSetitemCoercion.test_setitem_index_objecto   s     iiBHHT&\,PQyy&(((
"88:DTHCCy4  //XN  DG     f!5VDI11#sIyQ	      s$   D
*C>0D
>D	D

Dc                    t        j                  g d      }|j                  j                  t        j
                  k(  sJ t        j                  dddd|g      }| j                  ||||       y )Nrf   r   rK   rW   rX   )rL   rM   r2   r   npr5   rk   rc   )rA   rq   rr   rs   rv   s        r   test_setitem_index_int64z,TestSetitemCoercion.test_setitem_index_int64   sY     ii%yy"((***HHaAq#./	--c3	9Mr!   gffffff@c                    t        j                  g dg d      }|j                  j                  t        j
                  k(  sJ t        j                  dddd|g      }| j                  ||||       y )Nrf   )rd    @@ffffff@rZ   rd   r|   r}   r~   )rL   rM   r2   r   ry   r6   rk   rc   )rA   rq   rr   r   rs   rv   s         r   test_setitem_index_float64z.TestSetitemCoercion.test_setitem_index_float64   s\     ii,@Ayy"**,,,HHc3S#67	--c3	9Mr!   Test not implementedreasonc                    t         r   r>   r@   s    r   test_setitem_series_periodz.TestSetitemCoercion.test_setitem_series_period       !!r!   c                    t         r   r>   r@   s    r   test_setitem_index_complex128z1TestSetitemCoercion.test_setitem_index_complex128   r   r!   c                    t         r   r>   r@   s    r   test_setitem_index_boolz+TestSetitemCoercion.test_setitem_index_bool   r   r!   c                    t         r   r>   r@   s    r   test_setitem_index_datetime64z1TestSetitemCoercion.test_setitem_index_datetime64   r   r!   c                    t         r   r>   r@   s    r   test_setitem_index_datetime64tzz3TestSetitemCoercion.test_setitem_index_datetime64tz   r   r!   c                    t         r   r>   r@   s    r   test_setitem_index_timedelta64z2TestSetitemCoercion.test_setitem_index_timedelta64   r   r!   c                    t         r   r>   r@   s    r   test_setitem_index_periodz-TestSetitemCoercion.test_setitem_index_period   r   r!   N)r,   rB   rC   r   r%   __annotations__rT   rc   rm   markparametrizer4   rl   rw   ry   r5   r6   rz   r   xfailr   r   r   r   r   r   r   rE   r!   r   rG   rG   K   s   F GY.2( [[3-!Z3-HRR [[1bhh-#rzz):S&MJNN [[1bjj/C+<sFmLNN [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[45" 6"r!   rG   c            	         e Zd ZdgZdZd Zej                  j                  ddde	fdde	fdde	fdde	fg      d	        Z
ej                  j                  dd
ddej                  fdde	fdde	fg      d        Zej                  j                  ddddej                  fdde	fdde	fg      d        Zej                  j                  d ej                   d      df ej                   dd      dfgddg      ej                  j                  d ej                   d       ej                   dd      dg      d               Zd Zej                  j                  d ej&                  dd      ddf ej                   d       ej                   d      e	fdde	fdde	fg      d        Zej                  j+                  d !      d"        Zej                  j+                  d !      d#        Zy$)%TestInsertIndexCoercionr2   insertc                    |j                         }|j                  d|      }t        j                  ||       |j                  |k(  sJ y)z!test coercion triggered by insertrK   N)r[   r   rP   assert_index_equalr   rA   originalvaluerS   r`   targetress          r   _assert_insert_conversionz1TestInsertIndexCoercion._assert_insert_conversion   s?    mmAu%
c8,yyN***r!   z"insert, coerced_val, coerced_dtyperK   rd   Fr   c                    t        j                  t        d      t              }|j                  t        k(  sJ t        j                  d|dddgt              }| j                  ||||       y )Nrg   rh   rJ   bcd)rL   rk   rN   r4   r   r   )rA   r   coerced_valcoerced_dtypers   rb   s         r   test_insert_index_objectz0TestInsertIndexCoercion.test_insert_index_object   sY     hhtF|62yyF"""hh[#sC8G&&sFCGr!   )rK   rK   Nc                    |}t        j                  g d|      }||n|}t        j                  d|dddg|      }| j                  ||||       y )Nrf   rh   rK   rW   rX   rY   )rL   rk   r   )rA   any_int_numpy_dtyper   r   r   r   rs   rb   s           r   test_insert_int_indexz-TestInsertIndexCoercion.test_insert_int_index   sT     $hh|51)6)Bhh;1a0F&&sFCGr!   )rK         ?Nc                    |}t        j                  g d|      }||n|}t        r|dk(  r|dk(  rt        j                  }t        j                  d|dddg|      }| j                  ||||       y )	N)r          @      @      @rh   float32rd   r   r   r   r   )rL   rk   r   ry   r   r   )rA   float_numpy_dtyper   r   r   r   rs   rb   s           r   test_insert_float_indexz/TestInsertIndexCoercion.test_insert_float_index   sq     "hh+59)6)Bey0[C5G JJMhh[#sC8N&&sFCGr!   fill_val,exp_dtype
2012-01-01datetime64[ns]
US/Easterntzdatetime64[ns, US/Eastern]r9   r:   idsinsert_value
Asia/Tokyoc                .   t        j                  g d|j                        j                  d      }|j                  |k(  sJ t        j                  d|j                         dddg|j                        j                  d      }| j                  ||||       |j                  rt        j                  d      }|j                  d	|      }|j                  t              j                  d	|      }|j                  t        k(  sJ t        j                  ||       t        j                  dd
      }|j                  d	|      }|j                  d	|j                  |j                  j                              }|j                  |j                  k(  sJ t        j                  ||       nyt        j                  dd
      }|j                  d	|      }|j                  t              j                  d	|      }|j                  t        k(  sJ t        j                  ||       d	}	|j                  d	|	      }|j                  t              j                  d	|	      }|d	   |	k(  sJ |j                  t        k(  sJ t        j                  ||       y )N)
2011-01-01
2011-01-02
2011-01-03
2011-01-04r   nsr   r   r   r   r   rK   r   )rL   DatetimeIndexr   as_unitr   dater   	Timestampr   astyper4   rP   r   
tz_convert)
rA   fill_valrr   r   rs   rb   tsresultrS   items
             r   test_insert_index_datetimesz3TestInsertIndexCoercion.test_insert_index_datetimes   s    D

'$- 	 yyI%%%8==?L,U{{
 '$- 	 	&&sHc9E;;l+BZZ2&Fzz&)00B7H>>V+++!!&(3l|<BZZ2&Fzz!R]]399<<%@AH>>SYY...!!&(3 l|<BZZ2&Fzz&)00B7H>>V+++!!&(3At$::f%,,Q5{d"""~~'''
fh/r!   c                   t        j                  g d      }|j                  dk(  sJ t        j                  g d      }| j                  |t        j                  d      |d       t        j
                  d      dfD ]d  }|j                  d|      }|j                  t              j                  d|      }|j                  t        k(  sJ t        j                  ||       f y )N)1 day2 day3 day4 daytimedelta64[ns])r   10 dayr   r   r   r   r   rK   )rL   TimedeltaIndexr   r   	Timedeltar   r   r   r4   rP   r   )rA   rs   rb   r   r   rS   s         r   test_insert_index_timedelta64z5TestInsertIndexCoercion.test_insert_index_timedelta64/  s     DEyy----  NO&&h'.?	
 \\,/3 	4DZZ4(Fzz&)00D9H>>V+++!!&(3		4r!   z2012-01Mfreq	period[M]c                b   t        j                  g dd      }|j                  dk(  sJ t        j                  dd      |t        j                  dd      t        j                  dd      t        j                  dd      g}t	        |t         j                        rIt        j                  |d      }| j                  ||||       | j                  |t        |      ||       y |j                  d	|      }|j                  t              j                  d	|      }t        j                  ||       t	        |t         j                        s`|j                  d	t        |            }|j                  t              j                  d	t        |            }t        j                  ||       y y )
N)2011-012011-022011-032011-04r   r   r   r   r   r   r   r   )rL   PeriodIndexr   Period
isinstancer   strr   r   r4   rP   r   r   )	rA   r   r   r   rs   datarb   r   rS   s	            r   test_insert_index_periodz0TestInsertIndexCoercion.test_insert_index_period?  sO    nnIPSTyyK''' IIic*IIic*IIic*IIic*
 fbii(..C0C**3]K **3FS-P ZZ6*Fzz&)00F;H!!&(3 fbll3As6{3::f-44QFD%%fh7	 4r!   r   r   c                    t         r   r>   r@   s    r   test_insert_index_complex128z4TestInsertIndexCoercion.test_insert_index_complex128g  r   r!   c                    t         r   r>   r@   s    r   test_insert_index_boolz.TestInsertIndexCoercion.test_insert_index_boolk  r   r!   N)r,   rB   rC   r%   r   r   rm   r   r   r4   r   ry   r6   r   r   rL   r   r   r   r   r   r   r   r   rE   r!   r   r   r      sy   iGF+ [[,6N#vE6"#v		
HH [[,#rzz"E6"#v		
HH [[, #rzz"E6"#v	

H
H [[R\\,')9:R\\,<8:VW	
 >*   [[	l	#\R\\,<%PRST(0	(0T4  [[,RYYys+YDR\\,'l)CVL6N#v		
88> [[45" 6" [[45" 6"r!   r   c            	      ,   e Zd ZdZ ej
                  g d      Zd Zd Zd Z	e
j                  j                  ddefdefd	efd
efg      d        Ze
j                  j                  ddej                  fdej                   fd	ej"                  fd
efg      d        Ze
j                  j                  ddej                   fdej                   fd	ej"                  fd
efg      d        Ze
j                  j                  ddej"                  fdej"                  fd	ej"                  fd
efg      d        Ze
j                  j                  ddefdefd	efd
ej*                  fg      d        Ze
j                  j                  d ej0                  d      df ej0                  dd      efgddg      d        Ze
j                  j5                  d      d        Ze
j                  j5                  d      d        Ze
j                  j5                  d      d        Ze
j                  j5                  d      d        Ze
j                  j                  d ej>                  d !       e d !       ejB                  d d"      g      d#        Z"d$ Z#y%)&TestWhereCoercionwhereTFTFc                    |j                         }|j                  ||      }t        j                  ||       |j                  |k(  sJ y)z test coercion triggered by whereN)r[   r   rP   assert_equalr   )rA   r   condrO   rS   r`   r   r   s           r   _assert_where_conversionz*TestWhereCoercion._assert_where_conversiont  s?     ll4(
X&yyN***r!   c                    du r |g d      }nIt        t        t        j                  f      rt	        j
                  d      }n |fddD              } ||d   |d   |d	   |d
   g|      }||fS )NT)TFTTrY   periodsc              3  (   K   | ]	  }|z    y wr   rE   )r   r   r   s     r   r   z3TestWhereCoercion._construct_exp.<locals>.<genexpr>  s     >A1x<>s   )rV            r   rK   rW   rX   rh   )r   r   ry   r9   rL   
date_range)rA   rs   r   r   rr   rO   rb   s      `   r   _construct_expz TestWhereCoercion._construct_exp}  sx    t45F8R]]";<]]8Q7F>>>FSVVAYAq	:)Ls{r!   c                     || j                         } ||d   ||d   |g|      }| j                  |||||       | j                  ||||      \  }}| j                  |||||       y )Nr   rW   rh   )_condr   r   )rA   rs   r   r   rr   r   rb   rO   s           r   	_run_testzTestWhereCoercion._run_test  ss    TZZ SVXs1vx8	J%%c43	J))#uh	J%%c4iHr!   r   rK   rd         ?      ?Tc                    |} |t        d      t              }|j                  t        k(  sJ | j                  ||||       y )Nrg   rh   )rN   r4   r   r   rA   index_or_seriesr   rr   r   rs   s         r   test_where_objectz#TestWhereCoercion.test_where_object  s=    
  DL/yyF"""sHeY7r!   c                    |} |g d      }|j                   t        j                  k(  sJ | j                  ||||       y )Nrf   )r   ry   r5   r   rA   r  r   rr   r   r   rs   s          r   test_where_int64z"TestWhereCoercion.test_where_int64  s;    
  L!yyBHH$$$sHeY7r!   zfill_val, exp_dtypec                    |} |g d      }|j                   t        j                  k(  sJ | j                  ||||       y )N)rd   皙@ffffff
@皙@)r   ry   r6   r   r  s          r   test_where_float64z$TestWhereCoercion.test_where_float64  s<    
  ()yyBJJ&&&sHeY7r!   c                    |} |g dt         j                        }|j                  t         j                  k(  sJ | j                  ||||       y )N)r          @       @      @      @      @      @rh   )ry   r7   r   r   r  s         r   test_where_complex128z'TestWhereCoercion.test_where_complex128  sB      4BMMJyyBMM)))sHeY7r!   c                    |} |g d      }|j                   t        j                  k(  sJ | j                  ||||       y )Nr   )r   ry   bool_r   r  s         r   test_where_series_boolz(TestWhereCoercion.test_where_series_bool  s<    
  ./yyBHH$$$sHeY7r!   r   r   r   r   r9   r:   r   c                ^   |} |t        j                  ddd      j                  d             }|j                  dk(  sJ |}|dk(  r;||j	                         |j                         fD ]  }| j                  ||||        y ||j	                         fD ]  }| j                  ||||        y )Nr   rY   Dr   r   r   )rL   r   
_with_freqr   to_pydatetimeto_datetime64r   )rA   r  r   rr   r   rs   fvscalars           r   test_where_datetime64z'TestWhereCoercion.test_where_datetime64  s      BMM,DOOPTUVyy,,,,((r//123C3C3EF >sFE9=> r//12 @sHeY?@r!   r   r   c                    t         r   r>   r@   s    r   test_where_index_complex128z-TestWhereCoercion.test_where_index_complex128  r   r!   c                    t         r   r>   r@   s    r   test_where_index_boolz'TestWhereCoercion.test_where_index_bool  r   r!   c                    t         r   r>   r@   s    r   test_where_series_timedelta64z/TestWhereCoercion.test_where_series_timedelta64  r   r!   c                    t         r   r>   r@   s    r   test_where_series_periodz*TestWhereCoercion.test_where_series_period  r   r!   r   	   daysr  c                   t        j                  dd      }t        j                  g d      }t        j                  d||dg      }|j                  ||      }t        j                  ||       t        j                  dd      }t        j                  |d   |||d	   gt        
      }|d   |u sJ |j                  ||      }t        j                  ||       y )Nz1 DayrY   r   )TFFTz4 DaysNaTr   r   rX   rh   rK   )rL   timedelta_rangery   arrayr   r   rP   r   r9   rk   r4   )rA   r   tdir   rS   r   dtnats          r   test_where_index_timedelta64z.TestWhereCoercion.test_where_index_timedelta64  s       !4xx23$$gueX%FG4'
fh/ eT*88SVUE3q6:&I{e###4'
fh/r!   c                   t        j                  ddd      }|j                  d      }t        j                  g d      }|d   |j
                  dz  z   }t        j                  ||d	   |g      }|j                  ||      }t        j                  ||       t        j                  ||j
                  dz  z   t        
      }|j                  ||      }t        j                  |d   |d	   |d   g      }t        j                  ||       t        j                  d      }t        j                  ||d	   |gt        
      }|j                  ||      }t        j                  ||       t        j                  dd      }	t        j                  |	|d	   |	gt        
      }|j                  ||	      }t        j                  ||       y )N
2016-01-01rX   QSr  Q)FTF
   rK   rh   r   rW   rY   r'  z
2020-04-21r  )rL   r   	to_periodry   r,  r   r   r   rP   r   asarrayr4   r   rk   r   )
rA   dtipir   r   rS   r   othertdpers
             r   test_where_index_periodz)TestWhereCoercion.test_where_index_period  sw   mmL!$?]]3xx,- 22%>>5"Q%"78$&
fh/ 

2",F;$&>>58RUE!H"=>
fh/ \\q!88RAO6:$#
fh/iic*88S"Q%-V<$$
fh/r!   N)$r,   rB   rC   r   ry   r,  r   r   r   r   rm   r   r   r4   r  r5   r6   r7   r  r  r  r  r  rL   r   r  r   r  r!  r#  r%  r   r   r;   r/  r=  rE   r!   r   r   r   p  s   FBHH/0E+	I [[
VsFmff%5f~F8	8 [[
RXXbjj)FBMM+BT6NS8	8 [[
RZZ3

+fbmm-DtVnU8	8 [["-- R]]#6N		
88 [[
VsFmff%5bhh7GH8	8 [[R\\,')9:R\\,<8&A	
 >*  @@ [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[,",,A&	q(9>2>>!S;QR00 0r!   r   c                  <   e Zd ZdZej
                  j                  d      d        Zd Zej
                  j                  dde
fde
fd	e
fd
e
fg      d        Zej
                  j                  ddej                  fdej                  fd	ej                  fd
e
fg      d        Zej
                  j                  ddej                  fdej                  fd	ej                  fd
e
fg      d        Zej
                  j                  d ej$                  d      df ej$                  dd      e
fde
fde
fgg d      d        Zej
                  j                  d ej$                  dd      df ej$                  d      e
f ej$                  dd      dfde
fde
fg      d        Zej
                  j                  dddd	d
 ej*                  ddd       ej$                  dd       ej$                  d       ej,                  d       ej.                  dd       g	      d!        Zej
                  j                  d      d"        Zej
                  j                  d      d#        Zej
                  j                  d      d$        Zej
                  j                  d      d%        Zej
                  j                  d      d&        Zej
                  j                  dddd	d
 ej*                  ddd       ej$                  dd       ej$                  d       ej,                  d       ej.                  dd'      g	      d(        Zej
                  j                  d      d)        Zej
                  j                  d      d*        Z y+),TestFillnaSeriesCoercionfillnar   r   c                    t         r   r>   r@   s    r   test_has_comprehensive_testsz5TestFillnaSeriesCoercion.test_has_comprehensive_tests(  r   r!   c                    |j                         }|j                  |      }t        j                  ||       |j                  |k(  sJ y)z!test coercion triggered by fillnaN)r[   r@  rP   r   r   r   s          r   _assert_fillna_conversionz2TestFillnaSeriesCoercion._assert_fillna_conversion,  s;    mmE"
X&yyN***r!   zfill_val, fill_dtyperK   rd   r   Tc                    |} |dt         j                  ddgt              }|j                  t        k(  sJ  |d|ddgt              }| j	                  ||||       y )NrJ   r   r   rh   )ry   nanr4   r   rD  rA   r  r   
fill_dtyper   rs   rb   s          r   test_fillna_objectz+TestFillnaSeriesCoercion.test_fillna_object3  s]    
  S"&&#s+6:yyF"""S(C-V<&&sHc:Fr!   zfill_val,fill_dtypec                    |} |dt         j                  ddg      }|j                  t         j                  k(  sJ  |d|ddg      }| j	                  ||||       y )Nrd   r
  r  )ry   rF  r   r6   rD  rG  s          r   test_fillna_float64z,TestFillnaSeriesCoercion.test_fillna_float64?  s]    
  S"&&#s+,yyBJJ&&&S(C-.&&sHc:Fr!   c                    |} |dt         j                  ddgt         j                        }|j                  t         j                  k(  sJ  |d|ddg      }| j	                  ||||       y )Nr   r  r  rh   )ry   rF  r7   r   rD  rG  s          r   test_fillna_complex128z/TestFillnaSeriesCoercion.test_fillna_complex128K  sc      VRVVVV4BMMJyyBMM)))VXvv67&&sHc:Fr!   r   r   r   r   r   )r9   r:   r4   r4   r   c                   |} |t        j                  d      t         j                  t        j                  d      t        j                  d      g      }|j                  dk(  sJ  |t        j                  d      |t        j                  d      t        j                  d      g      }| j	                  ||||       y )Nr   r   r   r   )rL   r   r*  r   rD  rG  s          r   test_fillna_datetimez-TestFillnaSeriesCoercion.test_fillna_datetime\  s      \*\*\*	
 yy,,,,\*\*\*	
 	&&sHc:Fr!   r   r   c           	        |}d} |t        j                  d|      t         j                  t        j                  d|      t        j                  d|      g      }|j                  dk(  sJ t	        |dd       |}n|j                  |      } |t        j                  d|      |t        j                  d|      t        j                  d|      g      }| j                  ||||       y )Nr   r   r   r   r   r   r   )rL   r   r*  r   getattrr   rD  )	rA   r  r   rH  r   r   rs   r  rb   s	            r   test_fillna_datetime64tzz1TestFillnaSeriesCoercion.test_fillna_datetime64tz|  s      \b1\b1\b1	
 yy88888T4(0B$$R(B\b1\b1\b1	
 	&&sHc:Fr!   r   rW   leftclosedr'  r1  r  c                >   t        j                  ddd      j                  dt        j                        }t        |j                  t         j                        sJ  ||      } ||d   ||d   |d   |d	   gt        
      }t        }| j                  ||||       y )Nr   g      @rightrT  rK   r   rW   rX   rY   rh   )
rL   interval_ranger   ry   rF  r   r   IntervalDtyper4   rD  )rA   r  r   iirs   rb   rH  s          r   test_fillna_intervalz-TestFillnaSeriesCoercion.test_fillna_interval  s     sC8??266J"((B$4$4555b!r!uh1r!ubeDFS
&&sHc:Fr!   c                    t         r   r>   r@   s    r   test_fillna_series_int64z1TestFillnaSeriesCoercion.test_fillna_series_int64  r   r!   c                    t         r   r>   r@   s    r   test_fillna_index_int64z0TestFillnaSeriesCoercion.test_fillna_index_int64  r   r!   c                    t         r   r>   r@   s    r   test_fillna_series_boolz0TestFillnaSeriesCoercion.test_fillna_series_bool  r   r!   c                    t         r   r>   r@   s    r   test_fillna_index_boolz/TestFillnaSeriesCoercion.test_fillna_index_bool  r   r!   c                    t         r   r>   r@   s    r   test_fillna_series_timedelta64z7TestFillnaSeriesCoercion.test_fillna_series_timedelta64  r   r!   Wc                >   t        j                  ddd      j                  dt         j                        }t	        |j
                  t         j                        sJ  ||      } ||d   ||d   |d   |d   gt        	      }t        }| j                  ||||       y )
Nr1  rY   r  r  rK   r   rW   rX   rh   )	rL   period_ranger   r*  r   r   PeriodDtyper4   rD  )rA   r  r   r9  rs   rb   rH  s          r   test_fillna_series_periodz2TestFillnaSeriesCoercion.test_fillna_series_period  s     __\13?FFq"&&Q"((BNN333b!r!uh1r!ubeDFS
&&sHc:Fr!   c                    t         r   r>   r@   s    r   test_fillna_index_timedelta64z6TestFillnaSeriesCoercion.test_fillna_index_timedelta64  r   r!   c                    t         r   r>   r@   s    r   test_fillna_index_periodz1TestFillnaSeriesCoercion.test_fillna_index_period  r   r!   N)!r,   rB   rC   r   rm   r   r   rB  rD  r   r4   rI  ry   r6   r7   rK  rM  rL   r   rO  rR  Intervalr   r   r[  r]  r_  ra  rc  re  rj  rl  rn  rE   r!   r   r?  r?  #  s)    F[[45" 6"+ [[
VsFmff%5f~FG	G [[
RZZ3

+fbmm-DtVnUG	G [["-- R]]#6N		
GG [[R\\,')9:R\\,<8&AK&M		
 ?  	G	G, [[R\\,<8:VWR\\,'0R\\,<8:VWK&M	

G
G8 [[BKK1V,BLL,7BLL&BLLa BIIlC(
	
GG [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[45" 6" [[BKK1V,BLL,7BLL&BLLa BIIlC(
	
GG [[45" 6" [[45" 6"r!   r?  c                     e Zd ZU dgZdZi Zded<   ddged<   dd	ged
<   ddged<   ddged<   ddged<    ej                  d       ej                  d      ged<   dD ]3  Z	de	 dZ
 ej                  de	       ej                  de	      gee
<   5  ej                  d       ej                  d      ged<    ej                  ddg      d         Z ej                  g d!      d"        Z ej                  g d!g d#$      d%        Zej                  d&        Zd' Zej&                  j)                  d(g d)d*      ej&                  j)                  d+d,d-gd*      d.               Zej&                  j)                  d(g d/d*      ej&                  j)                  d+g d/d*      d0               Zej&                  j/                  d12      d3        Zy4)5TestReplaceSeriesCoercionr3   replacezdict[str, list]reprJ   r   r4   rY   rV   r5   rd   r	  r6   r   r  r7   TFr8   r   r   r   )UTCr   zdatetime64[ns, ]r   r   r   r   dict)paramsc                    |j                   S r   paramrA   r   s     r   howzTestReplaceSeriesCoercion.how  s    }}r!   )	r4   r5   r6   r7   r8   r   datetime64[ns, UTC]r   r   c                    |j                   S r   ry  r{  s     r   from_keyz"TestReplaceSeriesCoercion.from_key
  s     }}r!   )	r4   r5   r6   r7   r8   r9   r:   r:   r;   )rw  r   c                    |j                   S r   ry  r{  s     r   to_keyz TestReplaceSeriesCoercion.to_key  s    2 }}r!   c                    |dk(  r1t        t        | j                  |   | j                  |               }|S |dk(  r3t        j                  | j                  |   | j                  |         }|S t
        )z9
        Object we will pass to `Series.replace`
        rv  r3   rZ   )rv  ziprs  rL   rM   
ValueError)rA   r|  r  r  replacers        r   r  z"TestReplaceSeriesCoercion.replacer5  so    
 &=C 2DHHV4DEFH
 	 H_yy&!1(9KLH  r!   c                   t        j                  ddgd      }t        j                  | j                  |   |d      }|j	                  |      }|j
                  |k(  sJ |j                  d      r|j                  d      ry |dv ry |d	k(  r|d
v s	|dk(  rV|dv rRt        r
t               rt        j                  d| d|        t        j                  | j                  |   |d|      }n%t        j                  | j                  |   |d      }|r$|j
                  dk(  r|j	                  t              }d}	t        }
|j
                  |j
                  k(  sC|j
                  t        k(  s0|j
                  j                  dv r|j
                  j                  dv rd }
t        j                  |
|	      5  |j!                  |      }d d d        t        j"                  |       y # 1 sw Y    xY w)NrX   rY   xxxr   yyyr2   r   r   )r   r}  r6   r5   r7   )r5   r6   z32-bit platform buggy: z -> )r2   r   r   string!Downcasting behavior in `replace`iufcri   )rL   rk   rM   rs  r   r   
startswithr   r   rm   skipr4   rp   kindrP   ro   rr  rQ   rA   r|  r  r  r  using_infer_stringr2   rs   rb   ru   warnr   s               r   test_replace_seriesz-TestReplaceSeriesCoercion.test_replace_seriesB  s   !Qe,ii*%eDjj"yyH$$$z*v/@/@/LNN	!f&9$3G)G.05hZtF8LM ))DHHV,EXVC ))DHHV,EFC#))x"7**V$C1II"yyF"		&(SYY^^v-ED''C8 	+[[*F	+ 	vs+	+ 	+s   5G&&G/r  )r   r8   r4   r7   r6   r5   )indirectr  r}  r   c                <   t        j                  ddgd      }t        j                  | j                  |   |d      }|j                  |k(  sJ t        j                  | j                  |   |d      }|r%|j                  dk(  r|j                  t              }n|j                  |k(  sJ d}	|j                  t        k7  rt        nd }
t        j                  |
|		      5  |j                  |      }d d d        t        j                  |       y # 1 sw Y    xY w)
NrX   rY   xyzr   r  r  r  r  ri   )rL   rk   rM   rs  r   r   r4   rp   rP   ro   rr  rQ   r  s               r   test_replace_series_datetime_tzz9TestReplaceSeriesCoercion.test_replace_series_datetime_tzl  s     !Qe,ii*%eDyyH$$$ii(EB#))x"7**V$C99&&&1 #		V 3}''C8 	+[[*F	+ 	vs+	+ 	+s   !DD)r   r}  r   c                   t        j                  ddgd      }t        j                  | j                  |   |d      }|j                  |k(  sJ t        j                  | j                  |   |d      }t
        }t        |j                  t         j                        rBt        |j                  t         j                        r|j                  |j                        }d }n|j                  |k(  sJ ||k(  rd }d}	t        j                  ||	      5  |j                  |      }
d d d        t        j                  
|       y # 1 sw Y    xY w)	NrX   rY   r  r   r  r  r  ri   )rL   rk   rM   rs  r   rp   r   DatetimeTZDtyper   rP   ro   rr  rQ   )rA   r|  r  r  r  r2   rs   rb   r  ru   r   s              r   %test_replace_series_datetime_datetimez?TestReplaceSeriesCoercion.test_replace_series_datetime_datetime  s    !Qe,ii*%eDyyH$$$ii(EBcii!3!34IIr)):
 **SYY'CD99&&&!1''C8 	+[[*F	+ 	vs+	+ 	+s   EEr   r   c                    t         r   r>   r@   s    r   test_replace_series_periodz4TestReplaceSeriesCoercion.test_replace_series_period  r   r!   N)r,   rB   rC   r%   r   rs  r   rL   r   r   keyr   rm   fixturer|  r  r  r  r  r   r   r  r  r   r  rE   r!   r   rq  rq    s[   jGFC#JCMq6CL3ZC	N(C-CK)R\\,7l9STC# 
t1%BLL"-BLL"-
C
 +bll73\R\\'5JKCV^^FH-. / V^^

 V^^



010 ^^
 
(,T [[O  
 [[*,HITX  ,,* [[O  
 [[O  
,,0 [[45" 6"r!   rq  )
__future__r   r   r   r#   numpyry   rm   pandas.compatr   r   pandas.compat.numpyr   pandasrL   pandas._testing_testingrP   r  r/   r1   rG   r   r   r?  rq  rE   r!   r   <module>r     s    "    /   G, -:( (&d", d"N{"l {"|p0 p0fJ"| J"Z}" }"r!   