
    IR-e                        d dl Z d dlZd dlZd dlmZ d dlmZm	Z	  G d d          Z
ej                            dddg          ej                            dddg          d	                         Zd
 Zej                            dddg          ej                            dddg          ej                            dddg          d                                     Zd ZdS )    N)Time	TimeDeltac                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )TestTimeComparisonsz.Test Comparisons of Time and TimeDelta classesc                     t          t          j        dd          dd          | _        t          t          j        ddd          dd          | _        d S )	NiK  iU  mjdutc)formatscaleih  i8     )r   nparanget1t2)selfs    Clib/python3.11/site-packages/astropy/time/tests/test_comparisons.pysetup_methodz TestTimeComparisons.setup_method   sL    ry..uEJJJrys33EOOO    c                 B   t          dd          }t          j        dft          j        dft          j        dft          j        dffD ]B\  }}t          j        t                    5   ||d           ddd           n# 1 swxY w Y   C|dk    d	u sJ |dk    d
u sJ dS )z
        If an incompatible object is compared to a Time object, == should
        return False and != should return True. All other comparison
        operators should raise a TypeError.
        J2000r	   )r   z>=>z<=<NFT)	r   operatorgegtleltpytestraises	TypeError)r   r   opop_strs       r   test_miscomparesz$TestTimeComparisons.test_miscompares   s     ''''[$[#[$[#	
 	 	JB y))  2t               d
u$$$$d
t######s   &A??B	B	c                    | j         | j        k     }t          j        |t          j        g d          k              sJ | j         | j        k    }t          j        ||k              sJ | j         | j        k    }t          j        |t          j        g d          k              sJ | j         | j        k    }t          j        ||k              sJ | j         | j        k    }t          j        |t          j        g d          k              sJ | j         | j        k    }t          j        ||k              sJ | j         d         | j        d         k    }|du sJ | j         d         | j        k    }t          j        |t          j        g d          k              sJ | j         | j        d         k    }	t          j        |	t          j        g d          k              sJ d S )N
FFFFFFTTTT)
FFFFFTTTTT)
FFFFFTFFFFr   T)
TTTTTFFFFF)
TTTTTTTTTT)r   r   r   allarray)
r   t1_lt_t2t1_ge_t2t1_le_t2t1_gt_t2t1_eq_t2t1_ne_t2t1_0_gt_t2_0
t1_0_gt_t2
t1_gt_t2_0s
             r   	test_timezTestTimeComparisons.test_time'   s7   7TW$vxRRR 
 
 	
 	
 	
 7dg%vh(*+++++7dg%vxQQQ 
 
 	
 	
 	
 7TW$vh(*+++++7dg%vxUUU 
 
 	
 	
 	
 7dg%vh(*+++++wqzDGAJ.t####WQZ$')
vxQQQ 
 
 	
 	
 	
 Wtwqz)
vxTTTUUV
 
 	
 	
 	
 	
 	
r   c                 J    | j         d         | j        d         k    }|du sJ d S )Nr   T)r   r   )r   r.   s     r   test_time_booleanz%TestTimeComparisons.test_time_booleanU   s/    wqzDGAJ.t######r   c                 "   | j         | j        z
  }t          j        t                    5  | j        |k     d d d            n# 1 swxY w Y   |t          dd          k    }t          j        |t          j        g d          k              sJ d S )N        sec)r
   r%   )	r   r   r   r   r    r   r   r&   r'   )r   dt	dt_gt_td0s      r   test_timedeltaz"TestTimeComparisons.test_timedeltaY   s    Wtw]9%% 	 	GbLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	3u5555	vxRRR 
 
 	
 	
 	
 	
 	
s   AAAN)	__name__
__module____qualname____doc__r   r#   r1   r3   r9    r   r   r   r      si        88P P P$ $ $(,
 ,
 ,
\$ $ $

 

 

 

 

r   r   swapTF
time_deltac                 v     fd}t          d          }|dt          j        z  z   }|t          dt          j        z            z   } |||          sJ  |||          sJ |dt          j        z  z   } |||dt          j        z            sJ  |||dt          j        z            rJ |g dt          j        z  z   }t          j         |||d	t          j        z            g d
k              sJ |dt          j        t                    j	        z  t          j        z  z   } |||          rJ dS )zTest functionality of Time.isclose() method.

    Run every test with 2 args in original order and swapped, and using
    Quantity or TimeDelta for atol (when provided).c                 h    r|| }} d|v rrt          |d                   |d<    | j        |fi |S Natolr   iscloser   r   kwargsr?   r@   s      r   isclose_swapz'test_isclose_time.<locals>.isclose_swapn   S     	BV
&vf~66F6Nrz"'''''r   z2018-07-24T10:41:56.807015240r5      ߼xV4>rD   )QΠE>r            ?TTF   N)
r   usr   dayr   r&   finfofloateps)r?   r@   rI   r   r   t3s   ``    r   test_isclose_timer\   f   sm   ( ( ( ( ( ( 
-	.	.B	cACiB	iac	""	"B<B<B	a!#gB<B[15%8999999|Bqu)<======	jjj13	B6,,r2C!#I666:M:M:MMNNNNN	a"(5//%%-	-B|B#######r   c                  t   t          d          } | dt          j        z  z   }d}t          j        t
          |          5  |                     d           d d d            n# 1 swxY w Y   d}t          j        t
          |          5  |                     |d           d d d            d S # 1 swxY w Y   d S )Nz2020:001rK   z3'other' argument must support subtraction with TimematchrR   K'atol' argument must be a Quantity or TimeDelta instance, got float instead)r   rU   rV   r   r   r    rF   r   r   r_   s      r   test_isclose_time_exceptionsrb      s6   	j		B	a!#gBAE	y	.	.	.  


3               	V 
 
y	.	.	.  


2s                 s#   A!!A%(A%	B--B14B1other_quantityc                      fd}fd}t          dt          j        z            }|dt          j        z  z   }|t          dt          j        z            z   } |||          sJ  |||          sJ  |||          sJ  |||          sJ |dt          j        z  z   } |||dt          j        z            sJ  |||dt          j        z            rJ  |||dt          j        z            sJ  |||dt          j        z            rJ t          d	t          j        z            }|g d
t          j        z  z   }t	          j         |||dt          j        z            g dk              sJ t	          j         |||dt          j        z            g dk              sJ t	          j        |                    |dt          j        z  d          g dk              sJ |dt	          j        t                    j	        z  t          j        z  z   } |||          rJ  |||          rJ dS )zTest functionality of TimeDelta.isclose() method.

    Run every test with 2 args in original order and swapped, and using
    Quantity or TimeDelta for atol (when provided), and using Quantity or
    TimeDelta for the other argument.c                 h    r|| }} d|v rrt          |d                   |d<    | j        |fi |S rC   rE   rG   s      r   rI   z,test_isclose_timedelta.<locals>.isclose_swap   rJ   r   c                     r|                     t          j                  }d|v rrt          |d                   |d<    | j        |fi |S rC   )torU   rW   r   rF   )r   r   rH   rc   r@   s      r   isclose_other_quantityz6test_isclose_timedelta.<locals>.isclose_other_quantity   s[     	quBV
&vf~66F6Nrz"'''''r   g      ?r5   rK   rL   rM   rN   r   rO   rR   rS   g      ?g333333?)rD   rtolrQ   N)
r   rU   rV   rW   r   r&   rF   rX   rY   rZ   )r?   r@   rc   rI   rh   r   r   r[   s   ```     r   test_isclose_timedeltarj      s   ( ( ( ( ( (( ( ( ( ( ( 
39		B	cACiB	iac	""	"B<B<B!!"b)))))!!"b)))))	a!#gB<B[15%8999999|Bqu)<======!!"b{QU/BCCCCCC%%b";3FGGGGGG	1qs7		B	jjj13	B6,,r2C!#I666:M:M:MMNNNNN6((RcACi@@@DWDWDWWXXXXX 6"**RcACic*::>Q>Q>QQRRRRR	a"(5//%%-	-B|B#####%%b"-------r   c                     t          dt          j        z            } | dt          j        z  z   }d}t          j        t
          |          5  |                     d           d d d            n# 1 swxY w Y   d}t          j        t
          |          5  |                     |d           d d d            d S # 1 swxY w Y   d S )NrK   z/other' argument must support conversion to daysr^   rR   r`   )r   rU   rV   r   r   r    rF   ra   s      r   !test_isclose_timedelta_exceptionsrl      s<   	1qs7		B	a!#gB=E	y	.	.	.  


3               	V 
 
y	.	.	.  


2s                 s$   A..A25A2B::B>B>)r   numpyr   r   astropy.unitsunitsrU   astropy.timer   r   r   markparametrizer\   rb   rj   rl   r>   r   r   <module>rs      sr               ( ( ( ( ( ( ( (W
 W
 W
 W
 W
 W
 W
 W
t $//e}55$ $ 65 0/$@   $//e}55)D%=990. 0. :9 65 0/0.f    r   