U
    NZf|                     @   s  d dl Z d dlmZmZmZmZ d dlZd dlmZ d dlZ	d dl
Z
d dlZd dlmZ d dlmZmZ d dlmZ d dlmZmZmZ erd dlZG dd	 d	Zd
d Ze
jdddgdd Zdd Ze
jdi ddidddgdd Ze
jdddgdd Zdd  Z d!d" Z!d#d$ Z"e
jd%d dge
jd&d'd(e	#d'd)d*ed+d,d-d d.d d ej$d/gd0d1 Z%e
jd2d3dge
jd%d dgd4d5 Z&d3gZ'erzd3e(d6gZ'W n ej)k
r   Y nX e
jd2e'e
jd7d8d9d:d;ed+d,d-dd.d d d d<d fed+d,d-dd.d d dd<dfgd=d> Z*e
jd2d3ge
jd?ed+d,d-dd.d d d d@fed+d,d-dd.d d ddAfgdBdC Z+dS )D    N)datedatetime	timedeltatimezone)tzutc)NpyDatetimeUnit)PY39PY310)OutOfBoundsDatetime)Period	Timedelta	Timestampc                   @   s  e Zd Zdd Zdd Zdd Zdd Zej	d	e
egd
d Zej	d	e
egdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zej	d d!d"d#d$gd%d& Zd'd( Zd)d* Zd+d, Zej	d-eed.d/d0d1d2d3d4d/d5ed.d/d0d1d2d3d4d/d6ed.d/d0d1d2d3d4d/d7d8	ed.d/d0d1d2d3d4d9d/d5	ed.d/d0d1d2d3d4ejd/d:	gd;d< Zej	d=d>d?gd@dA Z ej	dBdCdDdEdFd$d#d"d!gdGdH Z!dIdJ Z"dKdL Z#dMdN Z$dOdP Z%dQdR Z&ej	dBdSdTgdUdV Z'dWdX Z(dYdZ Z)d[d\ Z*d]d^ Z+ej	d_d9e,d`gdadb Z-ej	dcdddegdfdg Z.ej	dBdhdigdjdk Z/ej	dleegdmdn Z0dodp Z1dqdr Z2dsdt Z3d9S )uTestTimestampConstructorsc              	   C   s&   t jtdd td W 5 Q R X d S )Nzgives an invalid tzoffsetmatchz200622-12-31pytestraises
ValueErrorr   self r   S/tmp/pip-unpacked-wheel-nbcvw55c/pandas/tests/scalar/timestamp/test_constructors.py)test_construct_from_string_invalid_raises!   s    zCTestTimestampConstructors.test_construct_from_string_invalid_raisesc                 C   s\   t d}|jdkstt d}|jdks,tt d}|jdksBtt d}|jdksXtd S )Nz
01/30/2023sZ2015Q1z2016-01-01 1:30:01 PMz2016 June 3 15:25:01.345msr   unitAssertionErrorr   tsr   r   r   test_constructor_str_infer_reso+   s    z9TestTimestampConstructors.test_constructor_str_infer_resoc                 C   s\   t d}|jdkstt d}|jdks,tt d}|jdksBtt d}|jdksXtd S )	Nz2016-01-01 04:05:06-01:00r   z2016-01-01 04:05:06.000-01:00r   z 2016-01-01 04:05:06.000000-01:00usz#2016-01-01 04:05:06.000000001-01:00nsr   r   r   r   r   2test_constructor_from_iso8601_str_with_offset_reso=   s    zLTestTimestampConstructors.test_constructor_from_iso8601_str_with_offset_resoc                 C   s&   t ddd}t|}|jdks"td S )Ni  	      r   )r   r   r   r   )r   objr    r   r   r   &test_constructor_from_date_second_resoK   s    z@TestTimestampConstructors.test_constructor_from_date_second_resotypc              	   C   s>   |d}d| d}t jt|d t|dd W 5 Q R X d S )Nl    `n1! zcannot convert input z with the unit 'D'r   Dr   r   r   r
   r   )r   r)   valmsgr   r   r   ;test_construct_from_int_float_with_unit_out_of_bound_raisesR   s    zUTestTimestampConstructors.test_construct_from_int_float_with_unit_out_of_bound_raisesc                 C   sL   |d}t |dd}t d}||ks(tt |dd}t d}||ksHtd S )N   Yr+   z
2120-01-01Mz
1982-07-01r   r   )r   r)   r-   r    expectedr   r   r   'test_constructor_int_float_with_YM_unit[   s    zATestTimestampConstructors.test_constructor_int_float_with_YM_unitc              	   C   sT   d}t jt|d tddd W 5 Q R X t jt|d tddd W 5 Q R X d S )Nz9Conversion of non-round float with unit=[MY] is ambiguousr   g     b@r1   r+   r2   r   r   r.   r   r   r   8test_constructor_float_not_round_with_YM_unit_deprecatedh   s
    zRTestTimestampConstructors.test_constructor_float_not_round_with_YM_unit_deprecatedc                 C   sF   t d}d}t||d}t||}||ks4t|jdksBtd S )Nz1970-01-01 05:00:00z	UTC+05:00tz   )np
datetime64r   tz_localizer   hour)r   dtZtzstrr    Zaltr   r   r   #test_constructor_datetime64_with_tzr   s    
z=TestTimestampConstructors.test_constructor_datetime64_with_tzc                 C   s  d}t dddd}d}t| d |ks0t|||fdt dddd	|d
 fdt ddddddd|d fdtd|d fg}ddtjdfdddtddft	j
d ddfg}|D ]$\}}}t|t|fD ]>}	|	d}	|	dj|kstt|	}	|	dj|kstq|D ]\}
}t||
dt||
dfD ]}	|	d}	||d d  }|	dj|kshtt|	}	|	dj|kst|
d k	rt|	d}	nt|	dd}	||d d  }|	dj|ks4tq4qqd S )Nz2014-07-01 09:00     r&   r%        t  ʚ;z2014-07-01 10:00
        qaz2014-07-01 09:00:00.000008000r      @  z2014-07-01 09:00:00.000000005r:   Nr   UTCr   
Asia/Tokyor%   
US/Easternzdateutil/US/PacificiLPF  r#   r8   i  rK   )r   calendartimegm	timetupler   r   pytzutcFixedOffsetdateutilr9   tzoffsetas_unit_value
tz_convert)r   base_strbase_dtbase_expectedtests	timezonesdate_strZdate_objr4   resultr9   offsetexpected_tzexpected_utcr   r   r   test_constructor   s^    

z*TestTimestampConstructors.test_constructorc                 C   s  d}t dddd}d}t| d |ks0t||fd|d	 fd
|d fd|d fg}ddtjdfdddtddftj	
d ddfg}|D ]\}}t|fD ]4}|dj|kstt|}|dj|kstq|D ]r\}	}
t||	d}|}|dj|kstt|}|dj|ks&tt|d}|}|dj|kstqqtddd}|jtdjksrtd}t||kst|tt|ksttddd}|jtdjkstd}t||kst|tt|ksttd d!d}|jtd"jkstd#}t||ks$t|tt|ks:ttd$d%d}|jtd"jks\td&}t||ksrt|tt|kstd S )'Nz2014-07-01 11:00:00+02:00rA   rB   r&   r%   rC   rD   z2014-07-01 12:00:00+02:00rF   z#2014-07-01 11:00:00.000008000+02:00rH   z#2014-07-01 11:00:00.000000005+02:00r:   rI   rJ   r   rL   rN   rQ   rR   rS   rT   r#   r8   rK   z2013-11-01 00:00:00-0500zAmerica/Chicagoz2013-11-01 05:00z;Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago')rM   z6Timestamp('2013-11-01 14:00:00+0900', tz='Asia/Tokyo')z2015-11-18 15:45:00+05:45zAsia/Katmanduz2015-11-18 10:00z9Timestamp('2015-11-18 15:45:00+0545', tz='Asia/Katmandu')z2015-11-18 15:30:00+05:30zAsia/Kolkataz8Timestamp('2015-11-18 15:30:00+0530', tz='Asia/Kolkata'))r   rU   rV   rW   r   rX   rY   rZ   r[   r9   r\   r   r]   r^   r_   repreval)r   r`   ra   rb   rc   rd   re   r4   rf   r9   rg   rh   ri   r   r   r   "test_constructor_with_stringoffset   sh    


z<TestTimestampConstructors.test_constructor_with_stringoffsetc              	   C   sX   d}t jt|d ttd W 5 Q R X d}t jt|d ttd W 5 Q R X d S )NzCannot convert inputr      zCannot convert Periodz
1000-01-01)r   r   	TypeErrorr   slicer   r   r6   r   r   r   test_constructor_invalid  s    z2TestTimestampConstructors.test_constructor_invalidc              	   C   s   d}t jt|d tddd W 5 Q R X d}t jt|d tdtjdd W 5 Q R X d	}t jt|d td
d W 5 Q R X d S )NzJArgument 'tzinfo' has incorrect type \(expected datetime.tzinfo, got str\)r   z
2017-10-22rO   tzinfozat most one ofrK   )rs   r9   zHCannot pass a date attribute keyword argument when passing a date stringz
2012-01-01
US/Pacific)r   r   ro   r   r   rX   rY   r6   r   r   r   test_constructor_invalid_tz   s    z5TestTimestampConstructors.test_constructor_invalid_tzc              	   C   s6   d}d}d}t jt|d t|| W 5 Q R X d S )Nz%Y%m%d-%H%M%S-%f%zz20190129-235348-000001+0000z)Timestamp.strptime\(\) is not implementedr   )r   r   NotImplementedErrorr   strptime)r   fmtr    r.   r   r   r   test_constructor_strptime4  s
    z3TestTimestampConstructors.test_constructor_strptimec              
      s   t dddddt dddtjdt dddtjdt tdddtjdt tdddddt tdddtjdg t fd	d
 D std S )Ni  rE      rK   )yearmonthdayr9   r{   r|   r}   rs   rr   r8   c                 3   s   | ]}| d  kV  qdS )r   Nr   ).0r    Zstampsr   r   	<genexpr>G  s     zJTestTimestampConstructors.test_constructor_tz_or_tzinfo.<locals>.<genexpr>)r   rX   rY   r   allr   r   r   r   r   test_constructor_tz_or_tzinfo=  s    z7TestTimestampConstructors.test_constructor_tz_or_tzinfoc                 C   s0   t dddtjd}t dtjd}||ks,td S )N        rr   
2020-12-31)r   r   rY   r   )r   r    r4   r   r   r   'test_constructor_positional_with_tzinfoI  s    zATestTimestampConstructors.test_constructor_positional_with_tzinfokwd
nanosecondmicrosecondsecondminutec           	      C   sv   |dkr"t jjdd}|j| |di}tddtji|}|d	 di}tf |}td
tjd| }||ksrt	d S )Nr   zGH#45307)reason   r   r   r   rs   r   r   r8   )r   r   r   )
r   markZxfailnodeZ
add_markerr   r   rY   r   r   )	r   r   requestr   kwargsr    Z	td_kwargstdr4   r   r   r   5test_constructor_positional_keyword_mixed_with_tzinfoO  s    
zOTestTimestampConstructors.test_constructor_positional_keyword_mixed_with_tzinfoc              	   C   s  t rdnd}tjt|d tdd W 5 Q R X d}tjt|d tddd W 5 Q R X tjt|d tddd W 5 Q R X d	}tjt|d tddd W 5 Q R X tjt|d tddd
 W 5 Q R X ttdddttdkstttdddddddttdkstd S )Nz5'NoneType' object cannot be interpreted as an integerzan integer is requiredr     r&   month must be in 1..12r      day is out of range for month         r   20151112rn      ?B 2015-11-12 01:02:03.999999)r	   r   r   ro   r   r   rk   r   r6   r   r   r   test_constructor_positional`  s(     z5TestTimestampConstructors.test_constructor_positionalc              
   C   s$  d}t jt|d tddd W 5 Q R X d}t jt|d tdddd W 5 Q R X t jt|d tdd	dd W 5 Q R X d
}t jt|d tdddd W 5 Q R X t jt|d tdddd W 5 Q R X ttddddttdkstttddddddddttdks td S )Nz@function missing required argument 'day'|Required argument 'day'r   r   r&   r{   r|   r   r   )r{   r|   r}   r   r   r   r   r   r   r   rn   r   r   )r{   r|   r}   r>   r   r   r   r   )r   r   ro   r   r   rk   r   r6   r   r   r   test_constructor_keyword|  s:    


z2TestTimestampConstructors.test_constructor_keywordc                 C   s   t ddd}t| }||ks&t| | ks:ttj| dd}tddd|ks`t| | ksttt dddd	d	}t| }| |ksttd
dd}| }tj| dd}| |kstd S )Nr   r&   rO   r8   z
2000-01-01i  r      r   z	2011-4-16)r   r   fromordinal	toordinalr   Zto_pydatetime)r   baser    r?   ZstampZdt_tzr   r   r   test_constructor_fromordinal  s    z6TestTimestampConstructors.test_constructor_fromordinalrf   r   r&   rn   r   r   r:      )r   )r{   r|   r}   r>   r   r   r   r   rK   )	r{   r|   r}   r>   r   r   r   r   r9   N)r9   r   c              	   C   s<   t tddddddd|jd}|tdd	 }||ks8td S )
Nr   r&   rn   r   r   r:   r   r8   )Znanoseconds)r   r   r9   r   r   r   rf   r4   r   r   r   test_constructor_nanosecond  s     z5TestTimestampConstructors.test_constructor_nanosecondzZZ0ZZ00c              	   C   s6   d| }t jt|d td|  W 5 Q R X d S )NzAUnknown datetime string format, unable to parse: 2014-11-02 01:00r   z2014-11-02 01:00r   )r   r   r.   r   r   r   %test_constructor_invalid_Z0_isostring  s    
z?TestTimestampConstructors.test_constructor_invalid_Z0_isostringargr{   r|   r}   r>   c              	   C   s4   |di}d}t jt|d td| W 5 Q R X d S )Nr&   z-Cannot pass a date attribute keyword argumentr   2010-10-10 12:59:59.999999999)r   r   )r   r   kwargr.   r   r   r   )test_invalid_date_kwarg_with_string_input  s    zCTestTimestampConstructors.test_invalid_date_kwarg_with_string_inputc              	   C   sx   t tjjd }tjt|d ttjjd  W 5 Q R X t tjjd }tjt|d ttjjd  W 5 Q R X d S )Nrn   r   )strr   maxr^   r   r   r
   minr6   r   r   r    test_out_of_bounds_integer_value  s    z:TestTimestampConstructors.test_out_of_bounds_integer_valuec              	   C   s   t dd}t tjd| }t tjd}t| t| tjj	}t|| j
|ksftt|| j
|ks|tt dd}t dd}d}tjt|d t| W 5 Q R X tjt|d t| W 5 Q R X d S )	Nr&   ztimedelta64[us]zM8[us]z-292277022657-01-27T08:29mz292277026596-12-04T15:31zOut of boundsr   )r;   Ztimedelta64Zastyper<   r   r   r   r   Z	NPY_FR_usvalue_cresor   r   r   r   )r   Zone_usZ	min_ts_usZ	max_ts_usZus_valZtoo_lowZtoo_highr.   r   r   r   test_out_of_bounds_value  s    z2TestTimestampConstructors.test_out_of_bounds_valuec              	   C   s   d}t jt|d tdd W 5 Q R X t jt|d tdd W 5 Q R X td}|jdksjttd}|jdkstd S )Nz,Cannot cast .* to unit='ns' without overflowr   z
1676-01-01r#   z
2263-01-01r   )r   r   r   r   r]   r   r   )r   r.   r    r   r   r   test_out_of_bounds_string  s    z3TestTimestampConstructors.test_out_of_bounds_stringc              	   C   s*   d}t jt|d td W 5 Q R X d S )Nz7Out of bounds nanosecond timestamp: 2262-04-11 23:47:16r   z2262-04-11 23:47:16.854775808r,   r6   r   r   r   test_barely_out_of_bounds)  s    z3TestTimestampConstructors.test_barely_out_of_boundsc                 C   s   d}d}|D ]R}|D ]H}t ||}t|}|dkrJ|j|dks\tq|jtjj	kstqqt 
t j}d}|jd |jfD ]<}	dD ]2}t |	|}tjt|d t| W 5 Q R X qqd	}
|
D ]"}|D ]}t ||}t| qqd S )
N)z
1677-09-21z
2262-04-12)r*   hr   r   r   r"   )r   r   r"   i8z#Out of bounds nanosecond timestamp:r&   )r*   r   r   r   )z
1677-09-23z
2262-04-11)r;   r<   r   r^   viewr   r   r   ZNPY_FR_sr   ZiinfoZint64r   r   r   r   r
   )r   Zout_of_bounds_datesZ
time_unitsZdate_stringr   Zdt64r    infor.   r   Zin_bounds_datesr   r   r    test_bounds_with_different_units1  s*    z:TestTimestampConstructors.test_bounds_with_different_unitsz	001-01-01z
0001-01-01c              	   C   sp   d}t jt|d t|d W 5 Q R X t|}|jdksBt|j|j  krf|j	  krfdksln td S )Nz=Cannot cast 0001-01-01 00:00:00 to unit='ns' without overflowr   r#   r   r&   )
r   r   r
   r   r]   r   r   r{   r|   r}   )r   r   r.   r    r   r   r   %test_out_of_bounds_string_consistencyQ  s    z?TestTimestampConstructors.test_out_of_bounds_string_consistencyc                 C   s   t t j d S N)r   r   r   r   r   r   test_min_valid\  s    z(TestTimestampConstructors.test_min_validc                 C   s   t t j d S r   )r   r   r   r   r   r   test_max_valid`  s    z(TestTimestampConstructors.test_max_validc                 C   s   t d}t  }t }t ddd}t jdd}tdd}t|| |k sNtt|| |k sbtt|| |k svtt|d |d  |k std S )NnowrO   r8   r&   seconds)r   r   r   r   absr   r=   r   Zts_from_stringZts_from_methodZts_datetimeZts_from_string_tzZts_from_method_tzdeltar   r   r   test_nowd  s"    
z"TestTimestampConstructors.test_nowc                 C   s   t d}t  }t }t ddd}t jdd}tdd}t|| |k sNtt|| |k sbtt|| |k svtt|d |d  |k std S )NtodayrO   r8   r&   r   )r   r   r   r   r   r   r=   r   r   r   r   
test_today{  s"    
z$TestTimestampConstructors.test_todayr9   rt   c              	   C   s0   t d}d}tjt|d ||_W 5 Q R X d S )NZ2010zCannot directly set timezoner   )r   r   r   AttributeErrorr9   )r   r9   r    r.   r   r   r   test_disallow_setting_tz  s    z2TestTimestampConstructors.test_disallow_setting_tzrg   z+0300z+0200c                 C   s0   t d| dd}t |d}||ks,td S )Nz2016-10-30 03:00:00zEurope/Helsinkir8   )r   r_   r   )r   rg   r4   rf   r   r   r   !test_construct_timestamp_near_dst  s    z;TestTimestampConstructors.test_construct_timestamp_near_dstz2013/01/01 00:00:00+09:00z2013-01-01 00:00:00+09:00c                 C   s2   t |}t tdddtdd}||ks.td S )Ni  r&   i  r8   )r   r   rX   rZ   r   )r   r   rf   r4   r   r   r   +test_construct_with_different_string_format  s    zETestTimestampConstructors.test_construct_with_different_string_formatboxc              	   C   sz   dddt jd}d}tjt|d t|f |dd W 5 Q R X d}tjt|d t|f |t dd W 5 Q R X d S )	N  r&   r~   z#Cannot pass a datetime or Timestampr   rt   r8   rr   )rX   rY   r   r   r   r   r   )r   r   r   r.   r   r   r   *test_raise_tz_and_tzinfo_in_datetime_input  s    zDTestTimestampConstructors.test_raise_tz_and_tzinfo_in_datetime_inputc                 C   s>   t tdddt d}t tdddt }||ks:td S )Nr   r&   r8   )r   r   r   r=   r   r   r   r   r   *test_dont_convert_dateutil_utc_to_pytz_utc  s    zDTestTimestampConstructors.test_dont_convert_dateutil_utc_to_pytz_utcc                 C   s@   G dd dt }|ddd}t|}tddd}||ks<td S )Nc                   @   s   e Zd ZdS )zSTestTimestampConstructors.test_constructor_subclassed_datetime.<locals>.SubDatetimeN)__name__
__module____qualname__r   r   r   r   SubDatetime  s   r   r   r&   )r   r   r   )r   r   datarf   r4   r   r   r   $test_constructor_subclassed_datetime  s
    z>TestTimestampConstructors.test_constructor_subclassed_datetimec                 C   sN   t d}tddd}t ddd}||ks0t||ks<tt|t sJtd S )Nz2000-01-03 00:00:00r   r&   )r   r   fromisocalendarr   
isinstance)r   Zexpected_timestampZexpected_stdlibrf   r   r   r    test_constructor_fromisocalendar  s    z:TestTimestampConstructors.test_constructor_fromisocalendar)4r   r   r   r   r!   r$   r(   r   r   parametrizeintfloatr/   r5   r7   r@   rj   rm   rq   ru   ry   r   r   r   r   r   r   r   r   rX   rK   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r       s   



ET	
"



	! 



 


r   c                  C   s,   t ddd} | j}t | j}||ks(td S )Nl     !F dateutil/Europe/Londonr8   r   r^   r   )r    r4   rf   r   r   r   test_constructor_ambigous_dst  s    
r   epochl   ?2\BT, l   ?2\BT, c                 C   sD   t | dd}|j|}tdd}t |j| ks4t||ks@td S )Nzdateutil/America/Los_Angelesr8   r   r   )r   r9   dstr   r^   r   )r   r    rf   r4   r   r   r   "test_constructor_before_dst_switch  s
    
r   c                  C   s    t d} t | }|| kstd S )Nz2017-01-01T12r3   )r4   rf   r   r   r   #test_timestamp_constructor_identity  s    r   r   r{   r   r&   r   c              	   C   s>   d}d}d ||g}tjt|d tf |  W 5 Q R X d S )NzCfunction missing required argument '(year|month|day)' \(pos [123]\)z<Required argument '(year|month|day)' \(pos [123]\) not found|r   )joinr   r   ro   r   )r   Zmsg1Zmsg2r.   r   r   r    test_constructor_missing_keyword  s
    r   nanoi  c              	   C   s.   t jtdd tddd| d W 5 Q R X d S )Nznanosecond must be in 0..999r   i  r&   )r{   r|   r}   r   r   )r   r   r   r   test_timestamp_nano_range  s    r   c               	   C   sb   t dddj} | dkstd}t d}tjt|d |j W 5 Q R X |jd} | d	ks^td S )
Nz
1800-01-01r   r+   l  'pS zCannot convert Timestamp to nanoseconds without overflow. Use `.asm8.view\('i8'\)` to cast represent Timestamp in its own unit \(here, s\).$z
0300-01-01r   r   ldW
1 )r   r   r   r   r   OverflowErrorZasm8r   )rf   r.   r    r   r   r   test_non_nano_value  s    r   c               	   C   s.   d} t jt| d tddd W 5 Q R X d S )Nz5Valid values for the fold argument are None, 0, or 1.r   {   rn   foldr   )r.   r   r   r   -test_timestamp_constructor_invalid_fold_raise  s    r   c               
   C   sJ   d} t d}tjt| d$ ttddddddd|dd	 W 5 Q R X d S )
NzBpytz timezones do not support fold. Please use dateutil timezones.Europe/Londonr     rE      r      r9   r   )rX   r   r   r   r   r   r   )r.   r9   r   r   r   *test_timestamp_constructor_pytz_fold_raise  s    
r   r   ts_input    P7-f. gP[YѵCr#   2019-10-27 01:30:00+01:00r   rE   r   r   rr   c              	   C   s.   d}t jt|d t| |d W 5 Q R X d S )NzCannot pass fold with possibly unambiguous input: int, float, numpy.datetime64, str, or timezone-aware datetime-like. Pass naive datetime-like or build Timestamp from components.r   )r   r   r   )r   r   r.   r   r   r   (test_timestamp_constructor_fold_conflict(  s    r   r9   r   c              	   C   s0   t ddddd| |d}|j}|}||ks,td S )Nr   rE   r   r&   r   )r{   r|   r}   r>   r   r9   r   r   r   r   )r9   r   r    rf   r4   r   r   r   &test_timestamp_constructor_retain_fold?  s    r   r   zts_input,fold_out)r   r   )l    pFs. r&   )r   r   )z2019-10-27 01:30:00+00:00r&   r   c                 C   s&   t || d}|j}|}||ks"td S )Nr8   r   )r9   r   Zfold_outr    rf   r4   r   r   r   0test_timestamp_constructor_infer_fold_from_valueR  s    r  zts_input,fold,value_outl    RzweW, l    v$iW, c                 C   s(   t || |d}|j}|}||ks$td S )Nr   r   )r9   r   r   Z	value_outr    rf   r4   r   r   r   0test_timestamp_constructor_adjust_value_for_foldh  s    r  ),rU   r   r   r   r   Zdateutil.tzr[   r   Znumpyr;   r   rX   Zpandas._libs.tslibs.dtypesr   Zpandas.compatr   r	   Zpandas.errorsr
   Zpandasr   r   r   Zzoneinfor   r   r   r   r   r   r   r   r   r   r   r<   rY   r   r   Z_tzsZZoneInfoZZoneInfoNotFoundErrorr  r  r   r   r   r   <module>   s        4





	
