
    i                     D    d Z ddlZddlZddlmZmZmZmZ  G d d      Zy)a]  
http://yaml.org/type/timestamp.html specifies the regexp to use
for datetime.date and datetime.datetime construction. Date is simple
but datetime can have 'T' or 't' as well as 'Z' or a timezone offset (in
hours and minutes). This information was originally used to create
a UTC datetime and then discarded

examples from the above:

canonical:        2001-12-15T02:59:43.1Z
valid iso8601:    2001-12-14t21:59:43.10-05:00
space separated:  2001-12-14 21:59:43.10 -5
no time zone (Z): 2001-12-15 2:59:43.10
date (00:00:00Z): 2002-12-14

Please note that a fraction can only be included if not equal to 0

    N   )
round_tripdedentround_trip_loadround_trip_dumpc                   `    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zy)TestDateTimec                 $    d}d}t        ||       y )Nz
        - 2011-10-02
        r   selfinpexps      v/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/srsly/tests/ruamel_yaml/test_datetime.pytest_date_onlyzTestDateTime.test_date_only        	3    c                 $    d}d}t        ||       y )Nz)
        - 2011-10-02 16:45:00.0
        '
        - 2011-10-02 16:45:00
        r   r   s      r   test_zero_fractionzTestDateTime.test_zero_fraction&   r   r   c                 $    d}d}t        ||       y )Na  
        - 2011-10-02 16:45:00.1234      # expand with zeros
        - 2011-10-02 16:45:00.123456
        - 2011-10-02 16:45:00.12345612  # round to microseconds
        - 2011-10-02 16:45:00.1234565   # round up
        - 2011-10-02 16:45:00.12345678  # round up
        a  
        - 2011-10-02 16:45:00.123400    # expand with zeros
        - 2011-10-02 16:45:00.123456
        - 2011-10-02 16:45:00.123456    # round to microseconds
        - 2011-10-02 16:45:00.123457    # round up
        - 2011-10-02 16:45:00.123457    # round up
        r   r   s      r   test_long_fractionzTestDateTime.test_long_fraction/   s     	3r   c                 $    d}d}t        ||       y )Nz*
        - 2011-10-02T16:45:00.1Z
        z/
        - 2011-10-02T16:45:00.100000Z
        r   r   s      r   test_canonicalzTestDateTime.test_canonical@   r   r   c                 $    d}d}t        ||       y )Nz*
        - 2011-10-02T11:45:00 -5
        z)
        - 2011-10-02T11:45:00-5
        r   r   s      r   test_spaced_timezonez!TestDateTime.test_spaced_timezoneI   r   r   c                     t        d       y )Nz
        - 2011-10-02T11:45:00-5
        - 2011-10-02 11:45:00-5
        - 2011-10-02T11:45:00-05:00
        - 2011-10-02 11:45:00-05:00
        r   r   s    r   test_normal_timezonez!TestDateTime.test_normal_timezoneR   s    	
r   c                 $    d}d}t        ||       y )Nz&
        - 2011-10-02 6:45:00
        z'
        - 2011-10-02 06:45:00
        r   r   s      r   test_no_timezonezTestDateTime.test_no_timezone\   r   r   c                 $    d}d}t        ||       y )N'
        - 2011-10-02T16:45:00
        r   r   s      r   test_explicit_TzTestDateTime.test_explicit_Te   r   r   c                 $    d}d}t        ||       y )Nz'
        - 2011-10-02t16:45:00
        r#   r   r   s      r   test_explicit_tzTestDateTime.test_explicit_tn   r   r   c                 $    d}d}t        ||       y )Nz)
        - 2011-10-02   16:45:00
        r   r   r   s      r   test_no_T_multi_spacez"TestDateTime.test_no_T_multi_spacew   r   r   c                     t        d       y )Nz-
        - 2011-10-02T15:45:00+01:00
        r   r   s    r   test_isozTestDateTime.test_iso       	
r   c                     t        d       y )Nz)
        - 2011-10-02T15:45:00+0
        r   r   s    r   test_zero_tzzTestDateTime.test_zero_tz   r+   r   c                     t        d       y )Nz*
        dt: 2016-08-19T22:45:47Z
        r   r   s    r   test_issue_45zTestDateTime.test_issue_45   r+   r   c                 v    t        d      }t        j                  t        |            }t	        |      |k(  sJ y )Nz)        foo: 2016-10-12T12:34:56
        )r   copydeepcopyr   r   )r   xdatas      r   test_deepcopy_datestringz%TestDateTime.test_deepcopy_datestring   s9    

 }}_Q/0t$)))r   N)__name__
__module____qualname__r   r   r   r   r   r   r!   r$   r&   r(   r*   r-   r/   r5    r   r   r	   r	      sH    "



*r   r	   )	__doc__r1   pytest	roundtripr   r   r   r   r	   r9   r   r   <module>r=      s$   &   K KA* A*r   