
    EgL                     d    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dS )    N)	TimedeltaTimedeltaIndextimedelta_rangeto_timedelta)DaySecondc            	          e Zd Zd Zd Zej                            dg d          d             Zej                            dg d          d             Z	ej                            d	d
dg          d             Z
d Zej                            dg d          d             Zd Zej                            ddddg ddfdddg ddfg          d             ZdS )TestTimedeltasc                     t          dddd          }t          j        dd          dz                      d	                              d
          }t          j        |                                |           d S )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      i/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/tests/indexes/timedeltas/test_timedelta_range.pytest_timedelta_range_unitz(TestTimedeltas.test_timedelta_range_unit   sn    hMMM9Rt,,,w6<<WEELLWUU
#CLLNNG<<<<<    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        ||           d S )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   sp   	!3777 13???
fh///	"C888 93???
fh///	!3777&))CceeK !35GcRRR
fh///c:::VAYYF !3QTJJJ
fh///	"E:::R? DDD
fh/////r    zdepr_unit, unit)
)Hhour)Tminute)tr8   )Ssecond)Lmillisecond)lr=   )Umicrosecond)ur@   )N
nanosecond)nrC   c                 0   d| d}t          t          j        d          |          }t          j        t
          |          5  t          t          j        d          |          }t          j        ||           d d d            d S # 1 swxY w Y   d S )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.   s    $ T	SSS 	  	!4888'XFFF 	4 	4!")A,,Y???F!&(333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   9BBBzperiods, freq))r)   r,   )r"   r#   )   19h12min)r*   16h)r+   12hc                 x    t          dd|          }t          dd|          }t          j        ||           d S )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   sE    
 !xXwOOO"xdKK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            n# 1 swxY w Y   t          j        ||           d S )	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   s     U(TTT xXqIII'SAAA 	P 	P&X8$OOOH	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P
fh/////s   AAAc                    d}t          j        t          |          5  t          d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          d           d d d            n# 1 swxY w Y   t          j        t          |          5  t                       d d d            n# 1 swxY w Y   t          j        t          |          5  t          ddd	d
           d d d            d S # 1 swxY w Y   d S )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11 	, 	,(++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, ]:S111 	* 	*))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* ]:S111 	' 	'A&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' ]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ]:S111 	P 	P("3OOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	PsU   ;??!A>>BB$CCC'DD	D(E		EE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 d S )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   sn     Es>>>3q6))))~~R((((3xx+++++++r    c                 <    t          ddd          }|j        J d S )N0s1s   ra   )r   r   )r   r3   s     r   test_timedelta_range_infer_freqz.TestTimedeltas.test_timedelta_range_infer_freq   s*     tR88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            n# 1 swxY w Y   t	          |d|          }t          j        ||           d S )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   s    : X	"WWW 	 'SAAA 	K 	K$5c	JJJF	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K!#4=
 
 
 	fh/////s   AAAN)__name__
__module____qualname__r   r4   rc   markparametrizerN   rY   r_   rf   rw   r|   r    r    r   r
   r
      s       = = =0 0 0* [	
 	
 	
 	4 	4 	4 [WWW 0 0 0 [-0A?/STT0 0 UT0P P P, [,	
 	
 	

 
, ,
 
,# # #
 [? PPP #   	
 00 01 00 0 0r    r
   )numpyr   rc   pandasr   r   r   r   pandas._testing_testingr   pandas.tseries.offsetsr   r   r
   r   r    r   <module>r      s                                [0 [0 [0 [0 [0 [0 [0 [0 [0 [0r    