a
    j=ic&                    @   s  d dl m Z mZ d dlZd dlZd dlmZ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 d dlmZ d dlmZmZmZ d dlmZmZmZ dd Zd	d
 ZG dd dZ G dd dZ!G dd dZ"G dd dZ#G dd dZ$G dd dZ%G dd dZ&dd Z'dS )    )datetime	timedeltaN)OutOfBoundsDatetimePerformanceWarning)		DataFrameDatetimeIndexNaTSeries	TimedeltaTimedeltaIndex	Timestampoffsetstimedelta_range)Float64Index
Int64IndexUInt64Index)assert_invalid_addsub_typeassert_invalid_comparisonget_upcast_boxc                 C   s   t | }||ksJ dS )zT
    Helper to check the dtype for a Series, Index, or single-column DataFrame.
    N)tm	get_dtype)objZexpected_dtypedtype r   y/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/pandas/tests/arithmetic/test_timedelta64.pyassert_dtype)   s    
r   c                 C   s8   | t u r|d }n"| tjtjfv r,|d }n|d }|S )Nr         )r   r   to_arraypdarray)boxnamesexnamer   r   r   get_expected_name2   s    

r$   c                   @   s^  e Zd Zdd Zejdeddeddedd	 e
dgdd Zejd	d
dededded  ed  ed edgdd Zejdeedededejedeejddddjeejdddeejdddejdddeejddddjejddddeg
dd Zdd ZdS )#TestTimedelta64ArrayLikeComparisonsc                 C   sz   |}|t jt jfvr|ntj}tddd}t| d }t||}||k}tg d}t||}t	|| d S )N2H   periodsr   )TFFF)
r   Indexr    npndarrayr   Zto_numpyr   box_expectedassert_equal)selfbox_with_arrayr!   xboxtdiotherresexpectedr   r   r    test_compare_timedelta64_zerodimG   s    zDTestTimedelta64ArrayLikeComparisons.test_compare_timedelta64_zerodim	td_scalarr   days   c                 C   sr   |}|t jt jfvr|ntj}ttddtddg}t||}||k}tddg}t||}t	|| d S )Nr   r8   r   FT)
r   r*   r    r+   r,   r	   r   r   r-   r.   )r/   r0   r7   r!   r1   seractualr5   r   r   r   !test_compare_timedeltalike_scalarW   s    zETestTimedelta64ArrayLikeComparisons.test_compare_timedeltalike_scalarinvalidl     x
Ii	 a
2021-01-01UTCr'   c                 C   s,   |}t ddd}t||}t||| d S N1 days
   r(   )r   r   r-   r   )r/   r0   r>   r!   rngr   r   r   r   test_td64_comparisons_invalidl   s    zATestTimedelta64ArrayLikeComparisons.test_td64_comparisons_invalidr3   rD   z
1970-01-01r)   tzr(   z
1971-01-01Dfreqr)   c                 C   s*   t dddj}t||}t||| d S rB   )r   _datar   r-   r   )r/   r3   r0   rE   r   r   r   "test_td64arr_cmp_arraylike_invalid   s    zFTestTimedelta64ArrayLikeComparisons.test_td64arr_cmp_arraylike_invalidc                 C   sD  t dddj}tddd|d tdg}||k}tg d	}t|| ||k}t||  d
}tjt	|d ||k  W d    n1 s0    Y  tjt	|d ||k W d    n1 s0    Y  tjt	|d ||k W d    n1 s0    Y  tjt	|d ||k W d    n1 s60    Y  d S )NrC      r(   r   r   r      r@   )FFFTFzDInvalid comparison between|Cannot compare type|not supported betweenmatch)
r   rL   r+   r    r   r   assert_numpy_array_equalpytestraises	TypeError)r/   rE   r3   resultr5   msgr   r   r   test_td64arr_cmp_mixed_invalid   s     &&&zBTestTimedelta64ArrayLikeComparisons.test_td64arr_cmp_mixed_invalidN) __name__
__module____qualname__r6   rS   markparametrizer   r
   Zto_timedelta64r   Hourr=   r   nowto_datetime64to_pydatetimedater+   r    rF   listrangearangeastypefloat32objectr   
date_rangeZperiod_rangerM   rX   r   r   r   r   r%   B   sN   	


	

r%   c                   @   s   e Zd Zejddegdd Zejdedde	e	ddge
e
d	d
e
d	d
e
de
de
dd
e
d	d e
dd
e
dd ggdd Zdd ZdS )TestTimedelta64ArrayComparisonsr   Nc                 C   s"  t tdttdg}t tttdg}|| }}|tu rP|t|t }}||k}tg d}t|| ||k}tg d}t|| tg d}t|tk| tt|k| tg d}t|tk| tt|k| tg d}t|tk | tt|k| d S )NrC   3 days)FFT)TTF)FFFTTT)	r   r
   r   rh   rf   r+   r    r   rR   )r/   r   leftrightlhsrhsrV   r5   r   r   r   test_comp_nat   s(    
z-TestTimedelta64ArrayComparisons.test_comp_natidx2z2 dayz1 day 00:00:02z5 days 00:00:03r   rI   Znatr   srN   rO   c                 C   s   t dtdtddg}||k }tg d}t|| ||k}tg d}t|| ||k}tg d}t|| ||k}tg d}t|| ||k}tg d}t|| ||k}tg d}t|| d S )N1 dayz1 day 00:00:01z5 day 00:00:03)TFFFTF)TFFFTT)FFFFFT)TTTTTF)r   r   r+   r    r   rR   )r/   rr   Zidx1rV   r5   r   r   r   test_comparisons_nat   s6    z4TestTimedelta64ArrayComparisons.test_comparisons_natc                 C   s`   t ddd}||d k }tg ddgd  }t|| |t|k}||k}t|| d S )NrC   rD   r(   rO   rl   F   )r   r+   r    r   rR   rc   )r/   rE   rV   r5   expr   r   r   test_comparisons_coverage  s    z9TestTimedelta64ArrayComparisons.test_comparisons_coverage)rY   rZ   r[   rS   r\   r]   rh   rq   r   r   r+   r    timedelta64ru   rx   r   r   r   r   rj      s(   



%rj   c                   @   s~   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zej	
dddgdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )!TestTimedelta64ArithmeticUnsortedc                 C   sx  t g dddd}|d t|dfD ]>}t|t s8J t g dddd}t|| |jdks&J q&|d t|dfD ]>}t|t sJ t g dd	dd}t|| |jd	kszJ qz| t|fD ]>}t|t sJ t g d
ddd}t|| |jdksJ qt g dd	dd}t	|t
|fD ]D}t|t sBJ t g dd dd}t|| |jd u s.J q.d S )N)r&   4HZ6H8HZ10Hr&   xrK   namer   )r{   r|   Z12HZ16HZ20Hr{   )1Hr&   Z3Hr{   Z5HH)-2Hz-4Hz-6Hz-8Hz-10Hr   )r   z-1H0Hr   r&   )r&   r   r   r   r&   )r   r+   multiply
isinstancer   assert_index_equalrK   dividenegativeabsabsolute)r/   idxrV   rw   r   r   r   test_ufunc_coercions  s0    
z6TestTimedelta64ArithmeticUnsorted.test_ufunc_coercionsc                 C   s  t dtdgdd}tjdddd}td}td}d	}tjt|d
 ||  W d    n1 sb0    Y  tjt|d
 ||  W d    n1 s0    Y  d}tjt|d
 ||  W d    n1 s0    Y  d}tjt|d
 ||  W d    n1 s0    Y  || }t g ddd}t	
|| || }t g ddd}t	
|| || }t dtdgdd}t	j
||dd || }t dtdgdd}t	j
||dd || }tg dddd}t	j
||dd || }tdtdgdd}t	
|| d S )NrC   2 daysfoor   20130101rO   barr)   r   z0cannot subtract a datelike from a TimedeltaArrayrP   z#unsupported operand type\(s\) for -z((bad|unsupported) operand type for unary0 days-1 days-2 daysr   rC   r   r   F)Zcheck_namesr   20121231r   20130102rI   r~   r   Z20121230)r   r   r   ri   r
   r   rS   rT   rU   r   r   r   )r/   r2   dtitddtrW   rV   r5   r   r   r   test_subtraction_ops9  sF    &&&(
z6TestTimedelta64ArithmeticUnsorted.test_subtraction_opsc                 C   s  t jddd}t||}td}| }t jdddd}t||}tdd}tdd}| }td}	dd }
|| }td	}|
|| || }td	}|
|| || }td	}|
|| d
}tj	t
|d ||  W d    n1 s0    Y  d}tj	t
|d ||  W d    n1 s80    Y  d}tj	t
|d ||  W d    n1 st0    Y  d
}tj	t
|d ||  W d    n1 s0    Y  tj	t
|d ||  W d    n1 s0    Y  tj	t
|d ||  W d    n1 s 0    Y  d}tj	t
|d ||  W d    n1 s\0    Y  tj	t
|d ||  W d    n1 s0    Y  || }tg d}t||}t|| || }tg d}t||}t|| || }tg d}t||}t|| || }tg d}t||}t|| |	|	 }td	}|
|| ||	 }tg ddd}t||}t|| d S )Nr   rO   r(   z
US/EasternZCETrC   c                 S   s   | |ksJ t | tsJ d S N)r   r
   rV   r5   r   r   r   _checkv  s    zNTestTimedelta64ArithmeticUnsorted.test_subtraction_ops_with_tz.<locals>._checkr   z<Cannot subtract tz-naive and tz-aware datetime-like objects.rP   z6can't subtract offset-naive and offset-aware datetimesz%Cannot subtract tz-naive and tz-awarer   r   r   rH   )r   ri   r   r-   r   ra   Ztz_localizer
   rS   rT   rU   r   r.   r   )r/   r0   r   tsr   Zdti_tzZts_tzZts_tz2Zdt_tzr   r   rV   r5   rW   r   r   r   test_subtraction_ops_with_tzh  s    


&(((((((
z>TestTimedelta64ArithmeticUnsorted.test_subtraction_ops_with_tzc                 C   s   t dtdgdd}tjdddd}|| }t d	td	gdd}t|| || }t dtd
gdd}t|| || }tdtdg}t|| d S )NrC   r   r   r   r   rO   r   r   r   4 daysr   )r   r   r   ri   r   r   r   )r/   r2   r   rV   r5   r   r   r   test_dti_tdi_numeric_ops  s    z:TestTimedelta64ArithmeticUnsorted.test_dti_tdi_numeric_opsc                 C   s  t dtdgdd}tjdddd}td}td}|| }td	td
gdd}t|| || }td	td
gdd}t|| || }t dtdgdd}t|| || }t dtdgdd}t|| d}t	j
t|d  ||dd   W d    n1 s0    Y  t	j
t|d  |dd |  W d    n1 sD0    Y  d}t	j
t|d  |tg d  W d    n1 s0    Y  || }td	tdg}t|| || }td	tdg}t|| || }td	}||ksJ || }td	}||ksJ d S )NrC   r   r   r   r   rO   r   r   r   Z20130103rk   z$cannot add indices of unequal lengthrP   r   r   3Addition/subtraction of integers and integer-arraysr   r   rO   Z20130105)r   r   r   ri   r
   r   r   r   r   rS   rT   
ValueErrorrU   r   )r/   r2   r   r   r   rV   r5   rW   r   r   r   test_addition_ops  sH    000z3TestTimedelta64ArithmeticUnsorted.test_addition_opsrK   rI   Bc                 C   s   t jdd|d}|td }|td }|d}t|| |dkrt jjd}|j	|ksbJ |j	|kspJ |j	|ksJ n>|j	t jj
dksJ |j	d u sJ |j	t jj
dksJ |td }|td }t|| d S )Nz1/1/20002   r)   rK   r   inferrI   )r   ri   r   
_with_freqr   r   Ztseriesr   DayrK   ZBusinessDay)r/   rK   indexZshiftedbackr5   rV   r   r   r   test_timedelta  s     
z0TestTimedelta64ArithmeticUnsorted.test_timedeltac                 C   s   t dd}t|}|td }t|td }|td }t|td }|j|jksdJ |	d }t
|| |j|jksJ |	d }t
|| d S )NZ2013Z2014r   i )r   ri   r	   r   r^   r   r+   ry   rK   r   r   r   )r/   rE   rs   Zresult1Zresult2Zresult3Zresult4r   r   r   test_timedelta_tick_arithmetic  s    

z@TestTimedelta64ArithmeticUnsorted.test_timedelta_tick_arithmeticc                 C   s|   t dtdg}|j}tjdddd}|| }|| }t|| || }|| }t|| || }|| }t|| d S )NrC   r   z
1999-12-31rO   rI   r   )r   r   r    r   ri   r   r   )r/   r2   Ztdar   rV   r5   r   r   r   test_tda_add_sub_index.  s    z8TestTimedelta64ArithmeticUnsorted.test_tda_add_sub_indexc           	      C   s   |}t jdd|d}|d }|| }t||}t||}tt ||t }W d    n1 sl0    Y  t	|| d S )N
2016-01-01rO   rG   )
r   ri   r   r   r-   assert_produces_warningr   rf   rh   r.   )	r/   r0   tz_naive_fixturer!   r   r2   r   r3   rV   r   r   r   test_tda_add_dt64_object_arrayA  s    
,z@TestTimedelta64ArithmeticUnsorted.test_tda_add_dt64_object_arrayc                 C   sb   t dd}t dddd}t||}t||}|}||7 }t|| |tjur^t|| d S NrC   10 daysz1 days 02:00:00z10 days 02:00:00rI   rK   r   r   r-   r.   r   r*   r/   	two_hoursr0   rE   r5   Zorig_rngr   r   r   test_tdi_iadd_timedeltalikeS  s    

z=TestTimedelta64ArithmeticUnsorted.test_tdi_iadd_timedeltalikec                 C   s^   t dd}t dd}t||}t||}|}||8 }t|| |tjurZt|| d S NrC   r   z0 days 22:00:00z9 days 22:00:00r   r   r   r   r   test_tdi_isub_timedeltalikeb  s    


z=TestTimedelta64ArithmeticUnsorted.test_tdi_isub_timedeltalikec                 C   s^  t ddddd}|d|j  }t ddddd}t|| |jdksHJ |d|j  }t d	dddd}t|| |jdksJ |d }t ddd
dd}t|| |jd
ksJ |d }t ddddd}t|| |jdksJ | }t d	dddd}t|| |jdksJ t d	dddd}t|}tg ddd}t|| |jd u sZJ d S )Nr   rN   Z2Dr}   )r)   rK   r   r   r   r   r   Z4DrC   rI   z-2D)r   rC   r   rC   r   r   )r   rK   r   r   r   r   )r/   rE   rV   rw   r   r   r   test_tdi_ops_attributess  s8    z9TestTimedelta64ArithmeticUnsorted.test_tdi_ops_attributesN)rY   rZ   r[   r   r   r   r   r   rS   r\   r]   r   r   r   r   r   r   r   r   r   r   r   rz     s   /U8
rz   c                   @   s.   e Zd Zejdddgdd Zdd ZdS )	TestAddSubNaTMaskingstr_tsz
1950-01-01z
1980-01-01c           	      C   s   t ddg}t||}t|}|| | d| dg}|D ]8}|| }|tu rr|j	d t
u sJ qJ|d t
u sJJ qJd S )Nz24658 days 11:15:00r   zdatetime64[ns]zdatetime64[D])r   r   r   )r   to_timedeltar   r-   r   ra   r`   rf   r   ilocr   )	r/   r0   r   ZtdinatZtdobjr   Zts_variantsvariantr4   r   r   r   $test_tdarr_add_timestamp_nat_masking  s    z9TestAddSubNaTMasking.test_tdarr_add_timestamp_nat_maskingc                 C   s  t jtdd$ tddtd  W d    n1 s80    Y  t jtdd$ tdtdd  W d    n1 sz0    Y  tjd }d}t jt|d& tdgdtd  W d    n1 s0    Y  t jt|d& tdtdgd  W d    n1 s0    Y  t jt|d$ t|gt	d  W d    n1 sV0    Y  t jt|d& td	|gt	d  W d    n1 s0    Y  t jt|d0 t|d	d
gtd|dg  W d    n1 s0    Y  t
tg}ttgt	d }t|| t
dtg}td	tgt	d }t|| t
ttdg}ttd	d
gtdtdg }t|| d S )NZ10155196800000000000rP   iT rI   2000r   zOverflow in int64 additionrC   z5 days1 hoursz	7 secondsz4 hoursr   z5 hours)rS   rT   r   r   r   r   r   valueOverflowErrorr
   r   r   r   )r/   Z_NaTrW   rw   rV   r   r   r   test_tdi_add_overflow  s<    22
4646"
z*TestAddSubNaTMasking.test_tdi_add_overflowN)rY   rZ   r[   rS   r\   r]   r   r   r   r   r   r   r     s   
r   c                	   @   s  e Zd Zdd Zdd Zdd Zejde	e
ejgdd	 Zd
d Zdd Zdd Zejdg dejdddgdd Zejddddedgdd Zejjdeg deg deg deg dggd d! d"d#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zejd/ed0egd1d2 Z d3d4 Z!d5d6 Z"d7d8 Z#d9d: Z$d;d< Z%ejd=ejejegd>d? Z&d@dA Z'dS )BTestTimedeltaArraylikeAddSubOpsc                 C   s  t tdg}t tdg}d}tjt|d  t ttg W d    n1 sX0    Y  t ttgdd}tdgt j}tdgt j}tjt|d" ttgt j W d    n1 s0    Y  ttj	gt j}t d}t d}	t d}
|| }||	ks"J |	| }||ks8J || }t
|| || }t
|| || }t
|| || }t
|| || }t
|| | | }t
|| ||
 }t
|| |
| }t
|| ||
 }t
|| |
 | }t
|| d}tjt|d |tj  W d    n1 s80    Y  tjt|d tj|  W d    n1 sr0    Y  tjt|d |tj  W d    n1 s0    Y  tjt|d tj |  W d    n1 s0    Y  |t }t
|| |t }t
|| || }t
|| || }t
|| || }t
|| || }t
|| || }t
|| || }t
|| || }t
|| || }t
|| ||
 }t
|| ||
 }t
|| d	}tjt|d |tj  W d    n1 s0    Y  tjt|d |tj  W d    n1 sP0    Y  |t }t
|| |t }t
|| d S )
Nz00:00:01z00:00:02z?dtype datetime64\[ns\] cannot be converted to timedelta64\[ns\]rP   m8[ns]r   r   unsupported operand typez8cannot subtract a datelike from|unsupported operand type)r   r   r	   rS   rT   rU   r   r   applyr   r   assert_series_equalr+   nanZassert_frame_equal)r/   s1s2rW   ZsnZdf1Zdf2dfnZscalar1Zscalar2Ztimedelta_NaTr<   r   r   r   &test_timedelta_ops_with_missing_values  s    .0




***,**zFTestTimedeltaArraylikeAddSubOps.test_timedelta_ops_with_missing_valuesc              	   C   s  t jdddd}t jdddd}t|t| }td|jdd}t|| |jdksbJ td	|i}td
d t	dD }|jdksJ |d	 |d	 
  }|jdksJ |d	 | }|jdksJ |d	  }t|tsJ |d	 |d	   }	|	jdksJ |	|d	  }tdtdtdg}
t|
d	d}t|| |d	 tddd }tdd t	dD d	d}t|| |jdksJ tddddd}|d	 | }|jdksJ || }	t|d	 |	 tdd}|d	 | }|| }	t|	|d	  |	jdksJ tddd}|d	 | }|| }	t|d	 |	 |	jdksRJ |d ttddd }|d  ttddd7  < |d |ksJ d S )Nz2012-1-1rO   rI   r   z2012-1-2g  S$Bint64timedelta64[ns]Ac                 S   s   g | ]}t |d qS )r8   r   .0ir   r   r   
<listcomp>S      zNTestTimedeltaArraylikeAddSubOps.test_operators_timedelta64.<locals>.<listcomp>zM8[ns]Z20111230Z20120101Z20120103r   i  r   c                 S   s   g | ]}t d | dqS )i  r8   r   r   r   r   r   r   l  r   r   r'   r8   rN   minutessecondsr   )r   ri   r	   r   rf   r   r   r   r   rd   shiftmaxr   r   r   r   r+   ry   )r/   v1v2rsZxpdfr   rV   ZmaxaZresultbvaluesr5   dZresultar   r   r   r   test_operators_timedelta64I  sV    
z:TestTimedeltaArraylikeAddSubOps.test_operators_timedelta64c                 C   s  t ttdg}t ttgdd}t tgdd}t|t | tt | | t|| | t| | | t|t | tt| | t|| | t|| | t|t | tt| | t|| | t|| | t|t | tt| | t|| | t|| | t|d | td| | t|d | td| | t|d t ttdg td| t ttdg t|tj | ttj| | t|d t ttd	g t|d
 t ttd	g t|tj | d S )N1sr   r         ?r         ?z1.5sr   z0.5s       @)r	   r   r
   r   r   r+   r   )r/   Ztimedelta_seriesZnat_series_dtype_timedeltaZsingle_nat_dtype_timedeltar   r   r   test_timedelta64_ops_nat  s|    
z8TestTimedeltaArraylikeAddSubOps.test_timedelta64_ops_natclsc                 C   s  |}t d|d}|tu r"| }n$|tju rB|d ur8d S | }n|}tddd}tjdd|d}t	
||}	t	
||}t	||	 | t	|	| | tjddd	|d
}
t	
|
|}
t	||	 |
 t	||	  |
 d}tjt|d |	|  W d    n1 s0    Y  d S )Nz
2012-01-01r   rt   rO   r(   z
2012-01-02rG   z
2011-12-31z-1D)r)   rK   rH   zcannot subtract a datelikerP   )r   r   ra   r+   
datetime64r`   r   r   ri   r   r-   r.   rS   rT   rU   )r/   r   r0   r   rH   Z	dt_scalarr   r2   r5   tdarrZ	expected2rW   r   r   r   (test_td64arr_add_sub_datetimelike_scalar  s,    


zHTestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_datetimelike_scalarc                 C   s^   t d}tddd}tg d}t||}t||}t|| | t|| | d S )Nr   rt   rO   r(   )r   r   r   )r+   r   r   r   r   r-   r.   )r/   r0   r3   r2   r5   tdserr   r   r   test_td64arr_add_datetime64_nat  s    
z?TestTimedeltaArraylikeAddSubOps.test_td64arr_add_datetime64_natc                 C   s   t jddd}tdgd }|j}t|| }t||}t||}d}tjt	|d ||  W d    n1 sv0    Y  || }t
|| d S )Nr   rO   r(   -1 Dayzcannot subtract a datelike fromrP   )r   ri   r   r   r   r   r-   rS   rT   rU   r.   )r/   r0   r   r2   dtarrr5   rW   rV   r   r   r   test_td64arr_sub_dt64_array  s    &z;TestTimedeltaArraylikeAddSubOps.test_td64arr_sub_dt64_arrayc                 C   sr   t jddd}tdgd }|j}t|| }t||}t||}|| }t|| || }t|| d S )Nr   rO   r(   r   )r   ri   r   r   r   r   r-   r.   )r/   r0   r   r2   r   r5   rV   r   r   r   test_td64arr_add_dt64_array"  s    z;TestTimedeltaArraylikeAddSubOps.test_td64arr_add_dt64_arraypi_freq)rI   WQr   tdi_freqNr   c           
      C   s   t ddg|d}td| }||}|d }t||}t||}d}	tjt|	d ||  W d    n1 sv0    Y  tjt|	d ||  W d    n1 s0    Y  d S )Nr   z2 hoursr   z2018-03-07 17:16:40r   z(cannot subtract|unsupported operand typerP   )r   r   Z	to_periodr   r-   rS   rT   rU   )
r/   r0   Zbox_with_array2r  r   r2   r   piZperrW   r   r   r   test_td64arr_sub_periodlike3  s    
&z;TestTimedeltaArraylikeAddSubOps.test_td64arr_sub_periodliker3   r?   r   r   r   c                 C   s*   t g ddd}t||}t|| d S N59 Daysr  r   r   r   )r	   r   r-   r   )r/   r0   r3   r   r   r   r   r   *test_td64arr_addsub_numeric_scalar_invalidH  s    zJTestTimedeltaArraylikeAddSubOps.test_td64arr_addsub_numeric_scalar_invalidvecr   c                 C   s
   t | jS r   typerY   r}   r   r   r   <lambda>b  r   z(TestTimedeltaArraylikeAddSubOps.<lambda>Zidsc                 C   s4   t g ddd}t||}||}t|| d S r  )r	   r   r-   rf   r   )r/   r0   r	  any_real_numpy_dtyper   r   vectorr   r   r   'test_td64arr_addsub_numeric_arr_invalidZ  s    
zGTestTimedeltaArraylikeAddSubOps.test_td64arr_addsub_numeric_arr_invalidc                 C   s   t dddd}t||}d}t||| tjt|d ||7 }W d    n1 sV0    Y  tjt|d ||8 }W d    n1 s0    Y  d S )N1 days 09:00:00r   rD   rJ    Addition/subtraction of integersrP   )r   r   r-   r   rS   rT   rU   )r/   r0   onerE   r   rW   r   r   r   test_td64arr_add_sub_intm  s    &z8TestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_intc                 C   sV   |}|t ju rtjn|}tdddd}t||}tg d|}d}t||| d S )Nr  r   rO   rJ   )r'   rO   r   r   )r   r    r+   r,   r   r   r-   r   )r/   r0   r!   r1   rE   r   r3   rW   r   r   r   "test_td64arr_add_sub_integer_array{  s    zBTestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_integer_arrayc                 C   sT   |}|t ju rtjn|}tg d}t||}tg d|}d}t||| d S )N)1 Dayr   z3 Hours)   r      r  )r   r    r+   r,   r   r   r-   r   )r/   r0   r!   r1   r2   r   r3   rW   r   r   r   )test_td64arr_addsub_integer_array_no_freq  s    zITestTimedeltaArraylikeAddSubOps.test_td64arr_addsub_integer_array_no_freqc           	      C   s   |}t jddd}||d }|j}d| }t||}t||}|| }t|| || }t|| d| }|| }t|| || }t|| d S )Nr   rO   r(   r   r   r   )r   ri   r   r   r   r-   r.   )	r/   r0   r!   r   r2   r   r5   rV   expected_subr   r   r   test_td64arr_add_sub_td64_array  s     z?TestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_td64_arrayc           	      C   s>  |}t ||}tddg|d d}|tjtjfv r<t|n|}ttddtddg|d d}ttddtddd	g|d}t	||}t	||}|| }t
|| t|d
 || }t
|| t|d
 ttddtddd	g|d}t	||}|| }t
|| t|d
 || }t
||  t|d
 d S )Nr   rt   r   r   rO   )hoursr'   r   )r9   r  r   )r$   r   r   r   r   r    r+   r	   r
   r-   r.   r   )	r/   r0   r"   r!   r#   r2   r;   r5   rV   r   r   r   test_td64arr_add_sub_tdi  s0    
 


z8TestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_tditdnatr   c                 C   s   |}t ttdg}t dgd }t||}t||}|| }t|| || }t|| || }t|| || }t|| d S )Nr   r   r   )r   r   r
   r   r-   r.   )r/   r0   r!  r!   r2   r5   r   rV   r   r   r   test_td64arr_add_sub_td64_nat  s    z=TestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_td64_natc                 C   s`   |}t dd}t dddd}t||}t||}|| }t|| || }t|| d S r   r   r   r-   r.   r/   r   r0   r!   rE   r5   rV   r   r   r   test_td64arr_add_timedeltalike  s    
z>TestTimedeltaArraylikeAddSubOps.test_td64arr_add_timedeltalikec                 C   s^   |}t dd}t dd}t||}t||}|| }t|| || }t||  d S r   r#  r$  r   r   r   test_td64arr_sub_timedeltalike  s    

z>TestTimedeltaArraylikeAddSubOps.test_td64arr_sub_timedeltalikec           
         s  |}t ||}tddg|d dtjtjddtjddg|d d |tjtj	fv rbt
	 n  t fdd	ttD d
|d}t fdd	ttD d
|d}t|t||}t||}tt   }W d    n1 s0    Y  t|| tt   }W d    n1 s>0    Y  t|| tt   }	W d    n1 s~0    Y  t|	| d S )N1 days 00:00:003 days 04:00:00r   r   r   nc                    s   g | ]}|  |  qS r   r   r   r*  r3   r2   r   r   r     r   zUTestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_offset_index.<locals>.<listcomp>r   r~   c                    s   g | ]}|  |  qS r   r   r,  r-  r   r   r     r   )r$   r   r   r*   r   r^   Minuter   r   r    r+   rd   lenr-   r   r   r.   )
r/   r"   r0   r!   r#   r5   r  r4   res2res_subr   r-  r   !test_td64arr_add_sub_offset_index  s.    
&&((zATestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_offset_indexc                    sZ  |}t ddgttjddtjddg t  fddttD dd	}t  fd
dttD dd	}t	|t	||}t
t   }W d    n1 s0    Y  t|| t
t   }W d    n1 s0    Y  t|| t	||}t
t   }W d    n1 s@0    Y  t|| d S )Nr'  r(  r   r)  r+  c                    s   g | ]}|  |  qS r   r   r,  r-  r   r   r   ,  r   zUTestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_offset_array.<locals>.<listcomp>r   r   c                    s   g | ]}|  |  qS r   r   r,  r-  r   r   r   /  r   )r   r+   r    r   r^   r.  rd   r/  r   r-   r   r   r.   )r/   r0   r!   r5   r  r4   r0  r1  r   r-  r   !test_td64arr_add_sub_offset_array%  s*    &&(zATestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_offset_arrayc                    s  |}|t jtjt jfv rtn|}t||}tddg|d dttj	ddtj
ddg|d d t fdd	ttD |d}t|}t||}tt |  }W d    n1 s0    Y  t|| tt  | }	W d    n1 s0    Y  t|	| t fd
d	ttD |d}
t|
|}
tt |  }W d    n1 sv0    Y  t||
 d S )Nr'  r(  r   r   r   r)  r+  c                    s   g | ]}|  |  qS r   r   r,  r-  r   r   r   K  r   zSTestTimedeltaArraylikeAddSubOps.test_td64arr_with_offset_series.<locals>.<listcomp>c                    s   g | ]}|  |  qS r   r   r,  r-  r   r   r   W  r   )r   r*   r   r   r    r	   r$   r   r   r^   r.  rd   r/  r-   r   r   r.   )r/   r"   r0   r!   Zbox2r#   Zexpected_addr   r4   r0  r  Zres3r   r-  r   test_td64arr_with_offset_seriesB  s&    
$$&($(z?TestTimedeltaArraylikeAddSubOps.test_td64arr_with_offset_seriesoboxc              	   C   s  t ddg}t||}|t tjddg}d}tjt|dB t	t
 ||  W d    n1 sl0    Y  W d    n1 s0    Y  tjt|dB t	t
 ||  W d    n1 s0    Y  W d    n1 s0    Y  tjt|dD t	t
 ||  W d    n1 s.0    Y  W d    n1 sN0    Y  tjt|dD t	t
 ||  W d    n1 s0    Y  W d    n1 s0    Y  d S )Nr'  r(  r   r)  z/has incorrect type|cannot add the type MonthEndrP   )r   r   r-   r   ZMonthEndr   rS   rT   rU   r   r   )r/   r5  r0   r2   ZanchoredrW   r   r   r   -test_td64arr_addsub_anchored_offset_arraylike^  s     DDHzMTestTimedeltaArraylikeAddSubOps.test_td64arr_addsub_anchored_offset_arraylikec           
   	   C   s  |}|t ju rtjn|}tdddd}t||}ttddt	dt
dg}tt || }W d    n1 sz0    Y  t tddtd	dt
d
g}t||}t|| d}	tjt|	dB tt ||  W d    n1 s0    Y  W d    n1 s0    Y  tt || }W d    n1 sL0    Y  t tdtdt
dg}t||}t|| d S )Nrt   rO   rI   r   r   r8   r   z
2000-01-04r'   z
2000-01-07z3unsupported operand type|cannot subtract a datelikerP   r   z
2000-01-01)r   r    r+   r,   r   r   r-   r
   r   r   r   r   r   r*   r.   rS   rT   rU   )
r/   r0   r!   r1   r2   r   r3   rV   r5   rW   r   r   r   !test_td64arr_add_sub_object_arrayy  s*     &F(zATestTimedeltaArraylikeAddSubOps.test_td64arr_add_sub_object_array)(rY   rZ   r[   r   r   r   rS   r\   r]   r   r   r+   r   r   r   r   r   r  r    r  r   r*   r	   r   r  r  r  r  r  r   ry   r   r"  r%  r&  r2  r3  r4  r6  r7  r   r   r   r   r     sZ   jBU
#



	#
 
r   c                
   @   s2  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Ze	j
jdeddeeddeeddeeddeddgdd ddd Zdd Zdd Zdd Zdd Ze	j
dg de	j
dg d d!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Z d1d2 Z!d3d4 Z"d5d6 Z#d7d8 Z$d9d: Z%d;d< Z&e	j
d=d>d?e'd>e'd?gd@dA Z(e	j
d=d>d?e'd>e'd?gdBdC Z)e	j
jdDe'g dEe*g dEe+g dEgdFd ddGdH Z,e	j
jdDe'g dEe*g dEe+g dEgdId ddJdK Z-dLdM Z.dNdO Z/dPdQ Z0dRS )STestTimedeltaArraylikeMulDivOpsc                 C   sJ   t tjddd}t||}|d }t|| d| }t|| d S )NrN   r   r   r   )r   r+   re   r   r-   r.   r/   r0   r   rV   r   r   r   test_td64arr_mul_int  s    z4TestTimedeltaArraylikeMulDivOps.test_td64arr_mul_intc                 C   sX   t dddd}t||}d}tjt|d ||  W d    n1 sJ0    Y  d S )NrC   r   r   r   z@argument must be an integer|cannot use operands with types dtyperP   )r   r   r-   rS   rT   rU   )r/   r   r0   rE   rW   r   r   r   %test_td64arr_mul_tdlike_scalar_raises  s
    zETestTimedeltaArraylikeMulDivOps.test_td64arr_mul_tdlike_scalar_raisesc                 C   s\   t jddd}t|}t|d }t||}t||}|t jddd }t|| d S )NrN   r   r   )r+   re   r   r   r-   r    r.   r/   r0   Zrng5r   r5   rV   r   r   r   test_tdi_mul_int_array_zerodim  s    z>TestTimedeltaArraylikeMulDivOps.test_tdi_mul_int_array_zerodimc                 C   sR   t jddd}t|}t|d }t||}t||}|| }t|| d S NrN   r   r   r   )r+   re   r   r   r-   r.   r<  r   r   r   test_tdi_mul_int_array  s    z6TestTimedeltaArraylikeMulDivOps.test_tdi_mul_int_arrayc                 C   s   |}|t jtjt jfv rtn|}ttjddd}ttjdddd }t	||}t	||}|ttjddd }t
|| d S r>  r   r*   r   r   r    r	   r   r+   re   r-   r.   )r/   r0   r!   r1   r   r5   rV   r   r   r   test_tdi_mul_int_series  s    z7TestTimedeltaArraylikeMulDivOps.test_tdi_mul_int_seriesc                 C   s   |}|t jtjt jfv rtn|}ttjddd}t	||}tjddd}t||d  }t	||}|t|d  }t
|| d S )NrN   r   r   float64r   r@  )r/   r0   r!   r1   r   Zrng5fr5   rV   r   r   r   test_tdi_mul_float_series  s    z9TestTimedeltaArraylikeMulDivOps.test_tdi_mul_float_seriesr3   r      c                 C   s
   t | jS r   r
  r  r   r   r   r    r   z(TestTimedeltaArraylikeMulDivOps.<lambda>r  c           	      C   sp   |}t dgd }tddd }t||}t||}t||}|| }t|| || }t|| d S )Nr  rD   rC   r   )r   r   r   r   r-   r   r.   )	r/   r3   r0   r!   r2   r5   r1   rV   Zcommuter   r   r   test_tdi_rmul_arraylike  s    
z7TestTimedeltaArraylikeMulDivOps.test_tdi_rmul_arraylikec                 C   s  t dddd}t||}tjtdd |t  W d    n1 sF0    Y  tjtdd t|  W d    n1 s|0    Y  tdd	}d
	g d}tjt|d ||  W d    n1 s0    Y  tjt|d ||  W d    n1 s0    Y  d S )NrC   r   r   r   r   rP   zCannot divide NaTType byr   ns|)z0ufunc '(true_divide|divide)' cannot use operandszcannot perform __r?truediv__z*Cannot divide datetime64 by TimedeltaArray)
r   r   r-   rS   rT   rU   r   r+   r   join)r/   r0   rE   Zdt64natrW   r   r   r   test_td64arr_div_nat_invalid  s    &&&z<TestTimedeltaArraylikeMulDivOps.test_td64arr_div_nat_invalidc                 C   s   |}|t ju rtjn|}tdd}t||}td}ttjgd }t||}|| }t	|| || }t	|| d S )NrC   r   r   rD   )
r   r    r+   r,   r   r   r-   ry   r   r.   )r/   r0   r!   r1   rE   r3   r5   rV   r   r   r   test_td64arr_div_td64nat  s    

z8TestTimedeltaArraylikeMulDivOps.test_td64arr_div_td64natc                 C   sl   t tjddd}t||}|d }t|| tjtdd d|  W d    n1 s^0    Y  d S )NrN   r   r   r   Cannot dividerP   	r   r+   re   r   r-   r.   rS   rT   rU   r9  r   r   r   test_td64arr_div_int,  s    z4TestTimedeltaArraylikeMulDivOps.test_td64arr_div_intc                 C   s   |}|t ju rtjn|}tdddd}ttdd d dd}t||}t||}|| }t	|| || }d| }t	|| d S )NrC   r   r   r   rD   r      )
r   r    r+   r,   r   r   re   r   r-   r.   r/   r   r0   r!   r1   rE   r5   rV   r   r   r   test_td64arr_div_tdlike_scalar7  s    z>TestTimedeltaArraylikeMulDivOps.test_td64arr_div_tdlike_scalarm)r   rO   rD   unit)rI   hrQ  rs   msusrF  c           
         s   |}|t ju rtjn|}ttddgd }tj|d< |}t||}t fdd|D }t||}|t	  }	t
|	| t fdd|D }t||}t	 | }	t
|	| d S )N;   r8   rO   r   c                    s   g | ]}|t   qS r   )r+   ry   r   r}   rQ  rR  r   r   r   U  r   zPTestTimedeltaArraylikeMulDivOps.test_td64arr_div_td64_scalar.<locals>.<listcomp>c                    s    g | ]}t t | qS r   )r
   r+   ry   rW  rX  r   r   r   [  r   )r   r    r+   r,   r	   r
   r   r   r-   ry   r.   )
r/   rQ  rR  r0   r!   r1   r;   Zflatr5   rV   r   rX  r   test_td64arr_div_td64_scalarI  s    
z<TestTimedeltaArraylikeMulDivOps.test_td64arr_div_td64_scalarc                 C   s   |}|t ju rtjn|}tdtdgdd}tdtjdgdd}t	||}t	||}|| }t
|| || }d| }t
|| d S )NrC   r   r   r   rN  r:   r   )r   r    r+   r,   r   r   r   r   r   r-   r.   rO  r   r   r   'test_td64arr_div_tdlike_scalar_with_nat`  s    zGTestTimedeltaArraylikeMulDivOps.test_td64arr_div_tdlike_scalar_with_natc                 C   s0  |}|t ju rtjn|}tdtdg}tdtjdg}t	||}t	||}tjg ddd}|| }t
|| |t	|| }t
|| ||t }t
|| |t| }t
|| d| }|| }t
|| t	||| }t
|| |t| }t
|| t|| }t
|| d S )	NrC   r   rN  r:   )r   r'   r   zm8[h]r   r   )r   r    r+   r,   r   r   r   r   r   r-   r.   rf   rh   rc   )r/   r0   r!   r1   rE   r5   r3   rV   r   r   r   test_td64arr_div_td64_ndarrayq  s0    z=TestTimedeltaArraylikeMulDivOps.test_td64arr_div_td64_ndarrayc              
   C   s   t dtdg}g d}t||}d}||d d fD ]}|t|t|fD ]p}tj	t
|d ||  W d    n1 s0    Y  tj	t
|d ||  W d    qP1 s0    Y  qPq6d S )NrC   r   )r   r   rO   r'   z0Cannot divide vectors|Unable to coerce to Seriesr   rP   )r   r   r   r-   r+   r    r   r*   rS   rT   r   )r/   r0   rE   Z
mismatchedrW   r   r3   r   r   r   test_tdarr_div_length_mismatch  s    &z>TestTimedeltaArraylikeMulDivOps.test_tdarr_div_length_mismatchc           	      C   s   |}|t ju rtjn|}tg ddd}tg ddd}t||}t||}tjddtjgtjd}t||}|t	u r|r|ddg 
d|ddg< || }t|| t|| }t|| d S )	N)  zd    r   r   )r]  r^  Nr   r   r   r   )r   r    r+   r,   r	   r   r-   r   rB  r   rf   r.   Zasarray)	r/   r0   Zusing_array_managerr!   r1   rm   rn   r5   rV   r   r   r   &test_td64arr_floordiv_td64arr_with_nat  s    zFTestTimedeltaArraylikeMulDivOps.test_td64arr_floordiv_td64arr_with_natc           	      C   s   |}|t ju rtjn|}td}t||tgdd}tj||dd}tddtj	g}tj||dd}|| }t
|| tddtj	g}tj||dd}|| }t
|| ||}t
|| d S )NZ5m3sr   r   F)Z	transposer   r   )r   r    r+   r,   r
   r	   r   r   r-   r   r.   __rfloordiv__)	r/   r0   	scalar_tdr!   r1   r   td1r5   rV   r   r   r   test_td64arr_floordiv_tdscalar  s    
z>TestTimedeltaArraylikeMulDivOps.test_td64arr_floordiv_tdscalarc                 C   sp   t tjddd}t||}|d }t|| d}tjt|d d|  W d    n1 sb0    Y  d S )NrN   r   r   r   z@floor_divide cannot use operands|Cannot divide int by Timedelta*rP   rL  )r/   r0   r   rV   patternr   r   r   test_td64arr_floordiv_int  s    z9TestTimedeltaArraylikeMulDivOps.test_td64arr_floordiv_intc                 C   s   t dd}t||}tg dd }t||}|| }t|| d }|tu rbt|tjrbt	}t
| t||}W d    n1 s0    Y  t|d | t|d ||  d S )Nr  9 days)r  z2 Days0 DaysrO   r   r   )r   r   r-   r   r.   r   r   r   Z
DateOffsetr   r   divmod)r/   r0   
three_daysr2   r   r5   rV   warnr   r   r   test_td64arr_mod_tdscalar  s    
(z9TestTimedeltaArraylikeMulDivOps.test_td64arr_mod_tdscalarc                 C   s   t dddd}t||}tddgd }t||}|d }t|| d}tjt|d	 d|  W d    n1 sz0    Y  t|d}t|d
 | t|d |d  d S )Nz1 nsz10 nsrD   r(   z0 nsrN   r   zCannot divide int byrP   r   r   )	r   r   r-   r   r.   rS   rT   rU   ri  )r/   r0   r2   r   r5   rV   rW   r   r   r   test_td64arr_mod_int  s    &
z4TestTimedeltaArraylikeMulDivOps.test_td64arr_mod_intc                 C   s   t dd}t||}g ddgd  }t|}t||}|| }t|| t||}t|d | t|d ||  d S )Nr  rg  )rh  r  rh  z3 Days   r   r   )r   r   r-   r   r.   ri  )r/   r0   rj  r2   r   r5   rV   r   r   r   test_td64arr_rmod_tdscalar  s    

z:TestTimedeltaArraylikeMulDivOps.test_td64arr_rmod_tdscalarc                 C   s   t tdddgd }tj|jd< t||}d}tjt	|d ||  W d    n1 s^0    Y  tjt	|d ||  W d    n1 s0    Y  d S NrN   rO   r   r   z(operate|unsupported|cannot|not supportedrP   
r	   r   r+   r   r   r   r-   rS   rT   rU   )r/   r0   rb  rc  re  r   r   r   !test_td64arr_mul_tdscalar_invalid&  s    &zATestTimedeltaArraylikeMulDivOps.test_td64arr_mul_tdscalar_invalidc                 C   s   t tjddd}t||}dg d}tjt|d  ||d d   W d    n1 s`0    Y  tjt	|d" |t
dd	g  W d    n1 s0    Y  d S )
NrN   r   r   rG  )$cannot use operands with types dtypez$Cannot multiply with unequal lengthszUnable to coerce to SeriesrP   rO   r   r   )r   r+   re   r   r-   rH  rS   rT   rU   r   r    r/   r0   r   rW   r   r   r   !test_td64arr_mul_too_short_raises5  s    .zATestTimedeltaArraylikeMulDivOps.test_td64arr_mul_too_short_raisesc                 C   s\   t tjddd}t||}d}tjt|d ||  W d    n1 sN0    Y  d S )NrN   r   r   rs  rP   )r   r+   re   r   r-   rS   rT   rU   rt  r   r   r   test_td64arr_mul_td64arr_raisesE  s
    z?TestTimedeltaArraylikeMulDivOps.test_td64arr_mul_td64arr_raisesc                 C   s   t g ddd}t g ddd}t||}t||}||  }t|| | | }t|| t g ddd}t||}|d|  }t|| d| | }t|| d S )Nr  r   r   )-59 Daysrw  r   r   )118 Daysrx  r   r   )r	   r   r-   r.   )r/   r0   r  r   r5   rV   r   r   r   test_td64arr_mul_numeric_scalarO  s    

z?TestTimedeltaArraylikeMulDivOps.test_td64arr_mul_numeric_scalartwor   r   c                 C   s   t g ddd}t g ddd}t||}t||}|| }t|| tjtdd ||  W d    n1 sx0    Y  d S Nr  r   r   )29.5Dr|  r   r   rK  rP   r	   r   r-   r.   rS   rT   rU   r/   r0   rz  r   r5   rV   r   r   r   test_td64arr_div_numeric_scalare  s    z?TestTimedeltaArraylikeMulDivOps.test_td64arr_div_numeric_scalarc                 C   s   t g ddd}t g ddd}t||}t||}|| }t|| tjtdd ||  W d    n1 sx0    Y  d S r{  r}  r~  r   r   r   $test_td64arr_floordiv_numeric_scalaru  s    zDTestTimedeltaArraylikeMulDivOps.test_td64arr_floordiv_numeric_scalarr  )   r_  (   c                 C   s
   t | jS r   r
  r  r   r   r   r    r   c                 C   sx   t g ddd}||}t g ddd}t||}t||}t||}|| }t|| || }t|| d S )Nr  r   r   )z	1180 Daysz	1770 Daysr   r   )r	   rf   r   r-   r   r.   )r/   r0   r  r  r   r5   r1   rV   r   r   r   test_td64arr_rmul_numeric_array  s    

z?TestTimedeltaArraylikeMulDivOps.test_td64arr_rmul_numeric_arrayc                 C   s
   t | jS r   r
  r  r   r   r   r    r   c                    sl  t g ddd |t g ddd}t | t }t||}  }t|| dg d}tjt	|d    W d    n1 s0    Y   t
 }|tu r؇ fd	d
ttD }n fdd
tt D }t|}t||}t|dksJ t|| tjt	|d t
   W d    n1 s^0    Y  d S )Nr  r   r   )z2.95Dz
1D 23H 12mr   r   rG  )z!true_divide'? cannot use operandszcannot perform __div__zcannot perform __truediv__zunsupported operandrK  rP   c                    s"   g | ]} j d |f |  qS )r   )r   r,  r   r  r   r   r     r   zRTestTimedeltaArraylikeMulDivOps.test_td64arr_div_numeric_array.<locals>.<listcomp>c                    s   g | ]} | |  qS r   r   r,  r  r   r   r     r   )r	   rf   r   r-   r   r.   rH  rS   rT   rU   rh   r   rd   r/  r   r*   r   )r/   r0   r  r  r5   r1   rV   re  r   r  r   test_td64arr_div_numeric_array  s.    

	&
z>TestTimedeltaArraylikeMulDivOps.test_td64arr_div_numeric_arrayc           
      C   s   |}t ||}tg d|d d}tg dtj|d d}tg dd|d}t||}t||}t||}|| }	t|	| || }	t|	| d S )	N0days1dayZ2daysZ3days4daysr   r   )r   r   r   rO   r'   r   r   r   )r  r  r  Z9daysZ16daysr   )	r$   r   r	   r+   r   r   r-   r   r.   )
r/   r0   r"   r!   r#   r2   r;   r5   r1   rV   r   r   r   test_td64arr_mul_int_series  s$    

z;TestTimedeltaArraylikeMulDivOps.test_td64arr_mul_int_seriesc                    s   |}t g d|d dtg dtj|d d |tjtjfvrH|d n|d }t fdd	tt	 D d
|d}t
|t }t
||} }|tu r|tu sJ nt|| d S )Nr  r   r   )r   rO   g      @rn  g      @r   r  r   c                    s   g | ]}|  |  qS r   r   r,  r;   r2   r   r   r     r   zRTestTimedeltaArraylikeMulDivOps.test_float_series_rdiv_td64arr.<locals>.<listcomp>r   )r   r	   r+   rB  r   r   r   r    rd   r/  r-   r   __rtruediv__r   NotImplementedr.   )r/   r0   r"   r!   Zxnamer5   r1   rV   r   r  r   test_float_series_rdiv_td64arr  s$     

z>TestTimedeltaArraylikeMulDivOps.test_float_series_rdiv_td64arrc                 C   sV   t ttg}t||}tjddgtd}|| }t|| || }t|| d S )Nr   r   r   )r   r   r   r-   r+   r    rh   r.   )r/   r0   r2   rm   rn   rV   r   r   r   -test_td64arr_all_nat_div_object_dtype_numeric  s    zMTestTimedeltaArraylikeMulDivOps.test_td64arr_all_nat_div_object_dtype_numericN)1rY   rZ   r[   r:  r;  r=  r?  rA  rC  rS   r\   r]   r+   re   r   rd   r   r   r   Z
RangeIndexrE  rI  rJ  rM  rP  rY  rZ  r[  r\  r`  rd  rf  rl  rm  ro  rr  ru  rv  ry  r    r  r  r*   r	   r  r  r  r  r  r   r   r   r   r8    sp   



&
 
 
$
$
,r8  c                   @   s   e Zd Zdd ZdS )"TestTimedelta64ArrayLikeArithmeticc                 C   s   t tdddgd }tj|jd< t||}d}tjt	|d ||  W d    n1 s^0    Y  tjt	|d ||  W d    n1 s0    Y  d S rp  rq  )r/   rb  r0   rc  re  r   r   r   test_td64arr_pow_invalid  s    &z;TestTimedelta64ArrayLikeArithmetic.test_td64arr_pow_invalidN)rY   rZ   r[   r  r   r   r   r   r    s   r  c                     sD   t d  tdddd } t fddtdD }t| | d S )Nr@   Z0sr      r(   c                    s6   g | ].} t d | t dt|dd    qS )z0.033333333sz0.000000001srO   r   )r   r   ri  r   	timestampr   r   r   1  s   z3test_add_timestamp_to_timedelta.<locals>.<listcomp>)r   r   r   rd   r   r   r   r   r  r   test_add_timestamp_to_timedelta,  s    

r  )(r   r   numpyr+   rS   Zpandas.errorsr   r   Zpandasr   r   r   r   r	   r
   r   r   r   r   Zpandas._testingZ_testingr   Zpandas.core.apir   r   r   Zpandas.tests.arithmetic.commonr   r   r   r   r$   r%   rj   rz   r   r   r8  r  r  r   r   r   r   <module>   s>   ,	mg   A     C     