
    OwgL                     \    d dl Zd dlZd dlmZmZmZmZ d dlm	Z
 d dlmZmZ  G d d      Zy)    N)	TimedeltaTimedeltaIndextimedelta_rangeto_timedelta)DaySecondc            	          e Zd Zd Zd Zej                  j                  dg d      d        Zej                  j                  dg d      d        Z	ej                  j                  d	d
dg      d        Z
d Zej                  j                  dg d      d        Zd Zej                  j                  ddddg ddfdddg ddfg      d        Zy)TestTimedeltasc                     t        dddd      }t        j                  dd      dz  j                  d	      j	                  d
      }t        j                  |j                         |       y )Nz0 Days
   100000Ds)periodsfrequniti8)dtypei zm8[D]zm8[s])r   nparangeviewastypetmassert_numpy_array_equalto_numpy)selftdiexp_arrs      k/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/indexes/timedeltas/test_timedelta_range.pytest_timedelta_range_unitz(TestTimedeltas.test_timedelta_range_unit   sS    hM99Rt,w6<<WELLWU
##CLLNG<    c                    t        t        j                  d      d      }t        ddd      }t	        j
                  ||       t        t        j                  d      d      }t        ddd      }t	        j
                  ||       t        t        j                  d      d      t        d	      z   t               z   }t        d
dd      }t	        j
                  ||       t        g dd      t        d	      z   }t        d
dd      }t	        j
                  ||       t        t        j                  d      d      dz  }t        ddd      }t	        j
                  ||       y )N   Dr   0 days)r   r      z10 days)r      z1 days, 00:00:02z5 days, 00:00:02)      r"      	   2D2   min   30min)r   r   )r   r   r   r   r   assert_index_equalr   r   )r   expectedresults      r   test_timedelta_rangez#TestTimedeltas.test_timedelta_range   s   		!37 13?
fh/		"C8 93?
fh/		!37&)CceK !35GcR
fh/c:VAYF !3QTJ
fh/		"E:R? D
fh/r    zdepr_unit, unit)
)Hhour)Tminute)tr8   )Ssecond)Lmillisecond)lr=   )Umicrosecond)ur@   )N
nanosecond)nrC   c                    d| d}t        t        j                  d      |      }t        j                  t
        |      5  t        t        j                  d      |      }t        j                  ||       d d d        y # 1 sw Y   y xY w)N'8' is deprecated and will be removed in a future version.r"   r$   match)r   r   r   r   assert_produces_warningFutureWarningr1   )r   	depr_unitr   depr_msgr2   r3   s         r   +test_timedelta_units_H_T_S_L_U_N_deprecatedz:TestTimedeltas.test_timedelta_units_H_T_S_L_U_N_deprecated.   su    $ 	{RS 	  		!48''XF 	4!"))A,Y?F!!&(3	4 	4 	4s   7BBzperiods, freq))r)   r,   )r"   r#   )   19h12min)r*   16h)r+   12hc                 h    t        dd|      }t        dd|      }t        j                  ||       y )Nr%   4 daysstartendr   rV   rW   r   )r   r   r1   )r   r   r   r3   r2   s        r   test_linspace_behaviorz%TestTimedeltas.test_linspace_behaviorH   s0    
 !xXwO"xdK
fh/r    zmsg_freq, freq)r5   19H12min)r7   19h12Tc                     d| d}t        ddd      }t        j                  t        |      5  t        dd|      }d d d        t        j                  |       y # 1 sw Y    xY w)	NrF   rG   r%   rT   rO   rU   rH   rX   )r   r   rJ   rK   r1   )r   r   msg_freqmsgr3   r2   s         r   #test_timedelta_range_H_T_deprecatedz2TestTimedeltas.test_timedelta_range_H_T_deprecatedQ   sh     (ST xXqI''SA 	P&X8$OH	P
fh/	P 	Ps   AA'c                 b   d}t        j                  t        |      5  t        d       d d d        t        j                  t        |      5  t        d       d d d        t        j                  t        |      5  t        d       d d d        t        j                  t        |      5  t                d d d        t        j                  t        |      5  t        ddd	d
       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   axY w# 1 sw Y   y xY w)NzVOf the four parameters: start, end, periods, and freq, exactly three must be specifiedrH   r%   )rV   z5 days)rW   r'   r   r   h)rV   rW   r   r   )pytestraises
ValueErrorr   )r   r^   s     r   test_errorszTestTimedeltas.test_errors[   s    . 	 ]]:S1 	,(+	, ]]:S1 	*)	* ]]:S1 	'A&	' ]]:S1 		 ]]:S1 	P("3O	P 	P	, 	,	* 	*	' 	'	 		P 	Ps;   C5D>D.DD%5C>D
DD"%D.z"start, end, freq, expected_periods))1D10Dr,   r"   )r,   30D3Dr   )2s50s5sr   )4D16Drj   r"   )8Dro   40siC  c                     t        |||      }t        |      |d   k(  sJ t        |      |d   k\  sJ t        |      |k(  sJ y )NrX   r   )r   r   len)r   rV   rW   r   expected_periodsress         r   $test_timedelta_range_freq_divide_endz3TestTimedeltas.test_timedelta_range_freq_divide_endq   sR     Es>3q6)))~R(((3x++++r    c                 <    t        ddd      }|j                  J y )N0s1s   ra   )r   r   )r   r3   s     r   test_timedelta_range_infer_freqz.TestTimedeltas.test_timedelta_range_infer_freq   s      tR8{{"""r    z5freq_depr, start, end, expected_values, expected_freqz3.5Sz05:03:01z05:03:10)z0 days 05:03:01z0 days 05:03:04.500000z0 days 05:03:083500msz2.5Tz5 hoursz5 hours 8 minutes)z0 days 05:00:00z0 days 05:02:30z0 days 05:05:00z0 days 05:07:30150sc                     d|d    d}t        j                  t        |      5  t        |||      }d d d        t	        |d|      }t        j
                  |       y # 1 sw Y   .xY w)NrF   rs   rG   rH   rX   ztimedelta64[ns])r   r   )r   rJ   rK   r   r   r1   )	r   	freq_deprrV   rW   expected_valuesexpected_freqr^   r3   r2   s	            r   $test_timedelta_range_deprecated_freqz3TestTimedeltas.test_timedelta_range_deprecated_freq   sw    : 	"VW 	 ''SA 	K$5c	JF	K!#4=
 	fh/	K 	Ks   A!!A*N)__name__
__module____qualname__r   r4   rc   markparametrizerN   rY   r_   rf   rw   r|   r    r    r   r
   r
      s   =0* [[	
	4	4 [[W00 [[-0A?/ST0 U0P, [[,	

,
,#
 [[? P # 	
00100r    r
   )numpyr   rc   pandasr   r   r   r   pandas._testing_testingr   pandas.tseries.offsetsr   r   r
   r   r    r   <module>r      s+       [0 [0r    