o
    ҷh                     @   s  d dl Z d dlmZmZmZmZ d dl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 d dlmZ d dlmZmZmZmZm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'z	d3e(d6gZ)W n ej*y   d3gZ)Y nw 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,ejdDde
j-e
$dEeegdFdG Z.dS )H    N)datedatetime	timedeltatimezone)tzutc)NpyDatetimeUnit)PY310)OutOfBoundsDatetime)NANaTPeriod	Timedelta	Timestampc                   @   s  e Zd Zdd Zd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$g d%d&d' Zd(d) Zd*d+ Zd,d- Ze	j
d.eed/d0d1d2d3d4d5d0d6ed/d0d1d2d3d4d5d0d7ed/d0d1d2d3d4d5d0d8d9	ed/d0d1d2d3d4d5d:d0d6	ed/d0d1d2d3d4d5ej d0d;	gd<d= Z!e	j
d>d?d@gdAdB Z"e	j
dCg d7dDdE Z#dFdG Z$dHdI Z%dJdK Z&dLdM Z'dNdO Z(e	j
dCdPdQgdRdS Z)dTdU Z*dVdW Z+dXdY Z,dZd[ Z-e	j
d\d:e.d]gd^d_ Z/e	j
d`dadbgdcdd Z0e	j
dCdedfgdgdh Z1e	j
dieegdjdk Z2dldm Z3dndo Z4dpdq Z5d:S )rTestTimestampConstructorsc                 C   s   t d}|jdksJ d S )Nz01:01:01.111msr   unitselfts r   b/var/www/html/venv/lib/python3.10/site-packages/pandas/tests/scalar/timestamp/test_constructors.pytest_construct_from_time_unit   s   z7TestTimestampConstructors.test_construct_from_time_unitc                 C   @   d}t jt|d td W d    d S 1 sw   Y  d S )NzFParsing datetimes with weekday but no day information is not supportedmatchz2023 Sept Thupytestraises
ValueErrorr   r   msgr   r   r   test_weekday_but_no_day_raises#   s   
"z8TestTimestampConstructors.test_weekday_but_no_day_raisesc                 C   s<   t jtdd td W d    d S 1 sw   Y  d S )Nzgives an invalid tzoffsetr   z200622-12-31r   r   r   r   r   )test_construct_from_string_invalid_raises)   s   
"zCTestTimestampConstructors.test_construct_from_string_invalid_raisesc                 C   s   t d}|jdksJ t d}|jdksJ t d}|jdks!J t d}|jdks,J t d}|jdks7J t d}|jdksBJ d S )	Nz
01/30/2023s2015Q1z2016-01-01 1:30:01 PMz2016 June 3 15:25:01.345r   z	300-01-01z300 June 1:30:01.300r   r   r   r   r   test_constructor_str_infer_reso3   s   z9TestTimestampConstructors.test_constructor_str_infer_resoc                 C   s\   t d}|jdksJ t d}|jdksJ t d}|jdks!J t d}|jdks,J 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_resoK   s   zLTestTimestampConstructors.test_constructor_from_iso8601_str_with_offset_resoc                 C   s&   t ddd}t|}|jdksJ d S )Ni  	      r%   )r   r   r   )r   objr   r   r   r   &test_constructor_from_date_second_resoY   s   z@TestTimestampConstructors.test_constructor_from_date_second_resotypc                 C   sT   |d}d| d}t jt|d t|dd W d    d S 1 s#w   Y  d S )Nl    `n1! zcannot convert input z with the unit 'D'r   Dr   r   r   r	   r   )r   r/   valr!   r   r   r   ;test_construct_from_int_float_with_unit_out_of_bound_raises`   s
   "zUTestTimestampConstructors.test_construct_from_int_float_with_unit_out_of_bound_raisesc                 C   sL   |d}t |dd}t d}||ksJ t |dd}t d}||ks$J d S )N   Yr1   z
2120-01-01Mz
1982-07-01r   )r   r/   r3   r   expectedr   r   r   'test_constructor_int_float_with_YM_uniti   s   zATestTimestampConstructors.test_constructor_int_float_with_YM_unitc                 C   s~   d}t jt|d tddd W d    n1 sw   Y  t jt|d tddd W d    d S 1 s8w   Y  d S )Nz9Conversion of non-round float with unit=[MY] is ambiguousr   g     b@r6   r1   r7   r   r    r   r   r   8test_constructor_float_not_round_with_YM_unit_deprecatedv   s   "zRTestTimestampConstructors.test_constructor_float_not_round_with_YM_unit_deprecatedc                 C   sF   t d}d}t||d}t||}||ksJ |jdks!J d S )Nz1970-01-01 05:00:00z	UTC+05:00tz   )np
datetime64r   tz_localizehour)r   dttzstrr   altr   r   r   #test_constructor_datetime64_with_tz   s   
z=TestTimestampConstructors.test_constructor_datetime64_with_tzc                 C   s  d}t dddd}d}t| d |ksJ |||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sxJ t|	}	|	dj|ksJ qg|D ]\\}
}t||
dt||
dfD ]K}	|	d}	||d d  }|	dj|ksJ t|	}	|	dj|ksJ |
d urt|	d}	nt|	dd}	||d d  }|	dj|ksJ qqqZd 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)   r<   i  rQ   )r   calendartimegm	timetupler   pytzutcFixedOffsetdateutilr=   tzoffsetas_unit_value
tz_convert)r   base_strbase_dtbase_expectedtests	timezonesdate_strdate_objr9   resultr=   offsetexpected_tzexpected_utcr   r   r   test_constructor   sd   
z*TestTimestampConstructors.test_constructorc                 C   sz  d}t dddd}d}t| d |ksJ ||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 ]}|dj|ks\J t
|}|dj|ksjJ qP|D ]7\}	}
t
||	d}|}|dj|ksJ t
|}|dj|ksJ t
|d}|}|dj|ksJ qmqGt
ddd}|jt
djksJ d}t||ksJ |tt|ksJ t
ddd}|jt
djksJ d}t||ksJ |tt|ksJ t
d d!d}|jt
d"jksJ d#}t||ks	J |tt|ksJ t
d$d%d}|jt
d"jks%J d&}t||ks0J |tt|ks;J d S )'Nz2014-07-01 11:00:00+02:00rG   rH   r,   r+   rI   rJ   z2014-07-01 12:00:00+02:00rL   z#2014-07-01 11:00:00.000008000+02:00rN   z#2014-07-01 11:00:00.000000005+02:00r>   rO   rP   r   rR   rT   rW   rX   rY   rZ   r)   r<   rQ   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')rS   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   r[   r\   r]   r^   r_   r`   ra   r=   rb   r   rc   rd   re   repreval)r   rf   rg   rh   ri   rj   rk   r9   rm   r=   rn   ro   rp   r   r   r   "test_constructor_with_stringoffset   sj   


z<TestTimestampConstructors.test_constructor_with_stringoffsetc                 C   s   d}t jt|d ttd W d    n1 sw   Y  d}t jt|d ttd W d    d S 1 s:w   Y  d S )NzCannot convert inputr      zCannot convert Periodz
1000-01-01)r   r   	TypeErrorr   slicer   r   r    r   r   r   test_constructor_invalid&  s   "z2TestTimestampConstructors.test_constructor_invalidc                 C   s   d}t jt|d tddd W d    n1 sw   Y  d}t jt|d tdtjdd W d    n1 s;w   Y  d	}t jt|d td
d W d    d S 1 sZw   Y  d S )NzJArgument 'tzinfo' has incorrect type \(expected datetime.tzinfo, got str\)r   z
2017-10-22rU   tzinfozat most one ofrQ   )rz   r=   zHCannot pass a date attribute keyword argument when passing a date stringz
2012-01-01
US/Pacific)r   r   rv   r   r   r^   r_   r    r   r   r   test_constructor_invalid_tz.  s   "z5TestTimestampConstructors.test_constructor_invalid_tzc                 C   sL   d}d}d}t jt|d t|| W d    d S 1 sw   Y  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_strptimeB  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 sCJ d S )Ni  rK      rQ   )yearmonthdayr=   r   r   r   rz   ry   r<   c                 3   s    | ]	}| d  kV  qdS )r   Nr   ).0r   stampsr   r   	<genexpr>U  s    zJTestTimestampConstructors.test_constructor_tz_or_tzinfo.<locals>.<genexpr>)r   r^   r_   r   allr#   r   r   r   test_constructor_tz_or_tzinfoK  s   z7TestTimestampConstructors.test_constructor_tz_or_tzinfoc                 C   s0   t dddtjd}t dtjd}||ksJ d S )N        ry   
2020-12-31)r   r   r_   )r   r   r9   r   r   r   'test_constructor_positional_with_tzinfoW  s   zATestTimestampConstructors.test_constructor_positional_with_tzinfokwd)
nanosecondmicrosecondsecondminutec           	      C   sz   |dkrt jjdd}|j| |di}tddtji|}|d di}td
i |}tdtjd	| }||ks;J d S )Nr   zGH#45307)reason   )r   r   r   rz   r%   r   r<   r   )	r   markxfailnode
add_markerr   r   r_   r   )	r   r   requestr   kwargsr   	td_kwargstdr9   r   r   r   5test_constructor_positional_keyword_mixed_with_tzinfo]  s   zOTestTimestampConstructors.test_constructor_positional_keyword_mixed_with_tzinfoc              	   C   s  t rdnd}tjt|d tdd W d    n1 sw   Y  d}tjt|d tddd W d    n1 s<w   Y  tjt|d tddd W d    n1 sYw   Y  d	}tjt|d tddd W d    n1 sxw   Y  tjt|d tddd
 W d    n1 sw   Y  ttdddttdksJ ttdddddddttdksJ 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   20151112ru      ?B 2015-11-12 01:02:03.999999)r   r   r   rv   r   r   rr   r    r   r   r   test_constructor_positionaln  s2    z5TestTimestampConstructors.test_constructor_positionalc              
   C   s  d}t jt|d tddd W d    n1 sw   Y  d}t jt|d tdddd W d    n1 s:w   Y  t jt|d tdd	dd W d    n1 sXw   Y  d
}t jt|d tdddd W d    n1 sxw   Y  t jt|d tdddd W d    n1 sw   Y  ttddddttdksJ ttddddddddttdksJ 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   ru   r   r   )r   r   r   rB   r   r   r   r   )r   r   rv   r   r   rr   r    r   r   r   test_constructor_keyword  sD   


z2TestTimestampConstructors.test_constructor_keywordc                 C   s   t ddd}t| }||ksJ | | ksJ tj| dd}tddd|ks0J | | ks:J t dddd	d	}t| }| |ksQJ td
dd}| }tj| dd}| |kslJ d S )Nr   r,   rU   r<   z
2000-01-01i  r      r   z	2011-4-16)r   r   fromordinal	toordinalto_pydatetime)r   baser   rC   stampdt_tzr   r   r   test_constructor_fromordinal  s   z6TestTimestampConstructors.test_constructor_fromordinalrm   r   r,   ru   r   r   r>      )r   )r   r   r   rB   r   r   r   r   rQ   )	r   r   r   rB   r   r   r   r   r=   N)r=   r   c              	   C   s<   t tddddddd|jd}|tdd	 }||ksJ d S )
Nr   r,   ru   r   r   r>   r   r<   )nanoseconds)r   r   r=   r   r   rm   r9   r   r   r   test_constructor_nanosecond  s    z5TestTimestampConstructors.test_constructor_nanosecondzZ0Z00c                 C   sL   d| }t jt|d td|  W d    d S 1 sw   Y  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argc                 C   sN   |di}d}t jt|d tdi | W d    d S 1 s w   Y  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   s   t tjjd }tjt|d ttjjd  W d    n1 s"w   Y  t tjjd }tjt|d ttjjd  W d    d S 1 sJw   Y  d S )Nru   r   )strr   maxrd   r   r   r	   minr    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s3J t|| j
|ks>J t dd}t dd}d}tjt|d t| W d    n1 sbw   Y  tjt|d t| W d    d S 1 s~w   Y  d S )	Nr,   ztimedelta64[us]zM8[us]z-292277022657-01-27T08:29mz292277026596-12-04T15:31zOut of boundsr   )r?   timedelta64astyper@   r   r   r   r   	NPY_FR_usvalue_cresor   r   r   )r   one_us	min_ts_us	max_ts_usus_valtoo_low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 d    n1 sw   Y  t jt|d tdd W d    n1 s9w   Y  td}|jdksIJ td}|jdksTJ d S )Nz,Cannot cast .* to unit='ns' without overflowr   z
1676-01-01r)   z
2263-01-01r%   )r   r   r   r   rc   r   )r   r!   r   r   r   r   test_out_of_bounds_string*  s   z3TestTimestampConstructors.test_out_of_bounds_stringc                 C   r   )Nz7Out of bounds nanosecond timestamp: 2262-04-11 23:47:16r   z2262-04-11 23:47:16.854775808r2   r    r   r   r   test_barely_out_of_bounds7  s   
"z3TestTimestampConstructors.test_barely_out_of_boundsc              
   C   s  d}d}|D ])}|D ]$}t ||}t|}|dv r%|j|dks$J q
|jtjjks.J q
qt 	t j
}d}|jd |jfD ](}	dD ]#}t |	|}tjt|d t| W d    n1 sbw   Y  qDq@d	}
|
D ]}|D ]}t ||}t| qqqmd S )
N)z
1677-09-21z
2262-04-12)r0   hr   r%   r   r(   )r%   r   r(   i8z#Out of bounds nanosecond timestamp:r,   )r0   r   r   r   )z
1677-09-23z
2262-04-11)r?   r@   r   rd   viewr   r   NPY_FR_sr   iinfoint64r   r   r   r   r	   )r   out_of_bounds_dates
time_unitsdate_stringr   dt64r   infor!   r   in_bounds_datesr   r   r    test_bounds_with_different_units?  s6   

z:TestTimestampConstructors.test_bounds_with_different_unitsz	001-01-01z
0001-01-01c                 C   s   d}t jt|d t|d W d    n1 sw   Y  t|}|jdks+J |j|j  kr>|j  kr>dksAJ  J d S )Nz=Cannot cast 0001-01-01 00:00:00 to unit='ns' without overflowr   r)   r%   r,   )	r   r   r	   r   rc   r   r   r   r   )r   r   r!   r   r   r   r   %test_out_of_bounds_string_consistency_  s   0z?TestTimestampConstructors.test_out_of_bounds_string_consistencyc                 C      t t j d S N)r   r   r#   r   r   r   test_min_validj     z(TestTimestampConstructors.test_min_validc                 C   r   r   )r   r   r#   r   r   r   test_max_validn  r   z(TestTimestampConstructors.test_max_validc                 C      t d}t  }t }t ddd}t jdd}tdd}t|| |k s'J t|| |k s1J t|| |k s;J t|d |d  |k sKJ d S )NnowrU   r<   r,   seconds)r   r   r   r   absrA   r   ts_from_stringts_from_methodts_datetimets_from_string_tzts_from_method_tzdeltar   r   r   test_nowr  s    
z"TestTimestampConstructors.test_nowc                 C   r   )NtodayrU   r<   r,   r   )r   r   r   r   r   rA   r   r   r   r   
test_today  s    
z$TestTimestampConstructors.test_todayr=   r{   c                 C   sF   t d}d}tjt|d ||_W d    d S 1 sw   Y  d S )N2010zCannot directly set timezoner   )r   r   r   AttributeErrorr=   )r   r=   r   r!   r   r   r   test_disallow_setting_tz  s
   "z2TestTimestampConstructors.test_disallow_setting_tzrn   z+0300z+0200c                 C   s0   t d| dd}t |d}||ksJ d S )Nz2016-10-30 03:00:00zEurope/Helsinkir<   )r   re   )r   rn   r9   rm   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J d S )Ni  r,   i  r<   )r   r   r^   r`   )r   r   rm   r9   r   r   r   +test_construct_with_different_string_format  s   zETestTimestampConstructors.test_construct_with_different_string_formatboxc                 C   s   dddt jd}d}tjt|d t|d	i |dd W d    n1 s'w   Y  d}tjt|d t|d	i |t dd W d    d S 1 sOw   Y  d S )
N  r,   r   z#Cannot pass a datetime or Timestampr   r{   r<   ry   r   )r^   r_   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J d S )Nr   r,   r<   )r   r   r   rA   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J 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  datarm   r9   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sJ ||ksJ t|t s%J d S )Nz2000-01-03 00:00:00r   r,   )r   r   fromisocalendar
isinstance)r   expected_timestampexpected_stdlibrm   r   r   r    test_constructor_fromisocalendar  s   z:TestTimestampConstructors.test_constructor_fromisocalendar)6r  r  r  r   r"   r$   r'   r*   r.   r   r   parametrizeintfloatr4   r:   r;   rF   rq   rt   rx   r|   r   r   r   r   r   r   r   r   r   r^   rQ   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J d S )Nl     !F dateutil/Europe/Londonr<   r   rd   )r   r9   rm   r   r   r   test_constructor_ambiguous_dst  s   
r  epochl   ?2\BT, l   ?2\BT, c                 C   sD   t | dd}|j|}tdd}t |j| ksJ ||ks J d S )Nzdateutil/America/Los_Angelesr<   r   r   )r   r=   dstr   rd   )r  r   rm   r9   r   r   r   "test_constructor_before_dst_switch  s
   
r  c                  C   s    t d} t | }|| u sJ d S )Nz2017-01-01T12r8   )r9   rm   r   r   r   #test_timestamp_constructor_identity  s   r  r   r   r   r,   r   c                 C   sX   d}d}d ||g}tjt|d tdi |  W d    d S 1 s%w   Y  d S )NzCfunction missing required argument '(year|month|day)' \(pos [123]\)z<Required argument '(year|month|day)' \(pos [123]\) not found|r   r   )joinr   r   rv   r   )r   msg1msg2r!   r   r   r    test_constructor_missing_keyword  s   "r  nanoi  c                 C   sD   t jtdd tddd| d W d    d S 1 sw   Y  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   sv   t dddj} | dksJ d}t d}tjt|d |j W d    n1 s(w   Y  |jd} | d	ks9J d S )
Nz
1800-01-01r%   r1   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   OverflowErrorasm8r   )rm   r!   r   r   r   r   test_non_nano_value  s   r   c                  C   sD   d} t jt| d tddd W d    d S 1 sw   Y  d S )Nz5Valid values for the fold argument are None, 0, or 1.r   {   ru   foldr   )r!   r   r   r   -test_timestamp_constructor_invalid_fold_raise$  s   "r$  c               
   C   s`   d} t d}tjt| d ttddddddd|dd	 W d    d S 1 s)w   Y  d S )
NzBpytz timezones do not support fold. Please use dateutil timezones.Europe/Londonr     rK      r      r=   r#  )r^   r   r   r   r   r   r   )r!   r=   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&  rK   r'  r(  ry   c                 C   sD   d}t jt|d t| |d W d    d S 1 sw   Y  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_conflict6  s
   "r.  r=   r  c              	   C   s0   t ddddd| |d}|j}|}||ksJ d S )Nr&  rK   r'  r,   r(  )r   r   r   rB   r   r=   r#  r   r#  )r=   r#  r   rm   r9   r   r   r   &test_timestamp_constructor_retain_foldM  s   r0  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J d S )Nr<   r/  )r=   r+  fold_outr   rm   r9   r   r   r   0test_timestamp_constructor_infer_fold_from_valuea  s   r2  zts_input,fold,value_outl    RzweW, l    v$iW, c                 C   s(   t || |d}|j}|}||ksJ d S )Nr)  r  )r=   r+  r#  	value_outr   rm   r9   r   r   r   0test_timestamp_constructor_adjust_value_for_foldw  s   r4  na_valuer   c                 C   s   t | }t}||u sJ d S r   )r   r   )r5  rm   r9   r   r   r   #test_timestamp_constructor_na_value  s   r6  )/r[   r   r   r   r   zoneinfodateutil.tzra   r   numpyr?   r   r^   pandas._libs.tslibs.dtypesr   pandas.compatr   pandas.errorsr	   pandasr
   r   r   r   r   r   r  r   r  r  r  r  r  r   r$  r*  r@   r_   r.  r0  ZoneInfo_tzsZoneInfoNotFoundErrorr2  r4  nanr6  r   r   r   r   <module>   s    	     E





	


