ó
wŰjc           @   s    d  Z  d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d   Z d   Z	 d e j
 f d     YZ d   Z e d	 k r e   n  d S(
   s   
Unittest for time.strftime
i˙˙˙˙N(   t   test_supportc         C   s-   |  d d k r) |  d  d |  d }  n  |  S(   Ni   t    t   0i	   (    (   t   s(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt
   fixasctime   s    c         C   sd   t  j |   } | j t  j |  |  } | j d d  } | j d d  } | j d d  } | S(   s   
    Escape text to deal with possible locale values that have regex
    syntax while allowing regex syntax used for comparison.
    s   \%t   %s   \:t   :s   \?t   ?(   t   ret   escapet   replace(   t   textt   ampmt   new_text(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt	   escapestr   s    t   StrftimeTestc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         O   s   t  j j |  | |  d  S(   N(   t   unittestt   TestCaset   __init__(   t   selft   kt   kw(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyR   !   s    c         C   s(  t  j |  |  _ t  j |  } | d d k  r= d |  _ n	 d |  _ t  j t  j | d d d d d d d d d f	   |  _ y1 | d r  t  j d |  _ n t  j d |  _ Wn t	 k
 rÍ d |  _ n X| d d k rň | d d |  _
 n) | d d k r| d |  _
 n	 d |  _
 | |  _ d  S(	   Ni   i   s   (AM|am)s   (PM|pm)i    i   i   t    (   t   timet   gmtimet   gmtt	   localtimeR   t   mktimet   jan1t   tznamet   tzt   AttributeErrort   clock12t   now(   R   R!   (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt   _update_variables$   s$     	:
   	c         C   s   y, d d  l  } | j j j | j j j  WnS t k
 r d d l m } m } | |  } | | d  |  j	 | | |  n Xd  S(   Ni˙˙˙˙(   t	   setlocalet   LC_TIMEt   C(
   t   javat   utilt   Localet
   setDefaultt   USt   ImportErrort   localeR#   R$   t
   addCleanup(   R   R&   R#   R$   t   saved_locale(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt   setUp:   s     c         C   sÔ   t  j    } |  j |  |  j |  |  j |  t j r^ d t j t j j	   d f GHn  xo t
 d d  D]^ } xU t
 d  D]G } | | | d d d } |  j |  |  j |  |  j |  q Wqn Wd  S(	   Ns/   Strftime test, platform: %s, Python version: %si    iű˙˙˙i   i   id   i   i  (   R   R"   t	   strftest1t	   strftest2R    t   verboset   syst   platformt   versiont   splitt   range(   R   R!   t   jt   it   arg(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt   test_strftimeD   s    	c         C   sË  t  j r d Gt j |  GHn  |  j } d t j | d d f d t j | d d f d t j | d d	 f d
 t j	 | d d f d d | d d f d d | d d f d d |  j
 d f d d | d d f d d | d d f d d | d d f d |  j d f d  d | d! d" f d# d | d |  j d d d$ f d% d& d | d d d' f d( d | d |  j d d d d d) f d* d+ | d | d | d! f d, f d- d | d. d/ d0 f d1 d | d. d2 f d9 f } xă | D]Ű } y t j | d. |  } Wn. t k
 r8} |  j d6 | d. | f  n Xt j t | d |  j  |  raqčn  | sx| d. d4 k r|  j d7 | d. | d f  qč|  j d8 | d. | d | d | f  qčWd  S(:   Ns   strftime test fors   %ai   s   abbreviated weekday names   %As   full weekday names   %bi   s   abbreviated month names   %Bs   full month names   %ds   %02di   s   day of month as number (00-31)s   %Hi   s   hour (00-23)s   %Is   hour (01-12)s   %js   %03di   s   julian day (001-366)s   %ms   month as number (01-12)s   %Mi   s   minute, (00-59)s   %ps   AM or PM as appropriates   %Si   s   seconds of current time (00-60)s   %Us!   week number of the year (Sun 1st)s   %ws   0?%ds   weekday as a number (Sun 1st)s   %Ws!   week number of the year (Mon 1st)s   %Xs   %02d:%02d:%02ds   %H:%M:%Ss   %yi    id   s   year without centurys   %Ys   year with centurys   %%R   s   single percent signs#   strftime '%s' format gave error: %ss3   strftime does not support standard '%s' format (%s)s-   Conflict for %s (%s): expected %s, but got %s(   s   %%R   s   single percent sign(   R    R2   R   t   ctimeR!   t   calendart   day_abbrt   day_namet
   month_abbrt
   month_nameR    R   R   t   strftimet
   ValueErrort   failR   t   matchR   (   R   R!   t   expectationst   et   resultt   error(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyR0   U   sH    		%%	"		c         C   s°  t  t |   d  } |  j } d t t j |   d f d d | d | d | d d	 f d
 f d d |  j d f d d | d | d | d d	 f d f d d | d d f d t j | d d f d d | d d f d3 d d |  j	 | d | d |  j
 f d f d  d! | d | d f d" f d | d# f d4 d' d( | d | d | d f d) f d* d+ | d d	 d, f f } x.| D]&} y t j | d |  } WnH t k
 rě} d- | d | d t  |  f } t j r| GHqqn Xt j t | d |  j
  |  r5t j r¨d. | d | d f GHq¨q| sL| d d/ k rrt j r¨d0 | d | d f GHq¨qt j rd1 | d | d f GHd2 | d | f GHqqWd  S(5   Ni˙˙˙˙s   %cs   near-asctime() formats   %xs   %02d/%02d/%02di   i   i    id   s   %m/%d/%y %H:%M:%Ss   %Zs   %ss   time zone names   %Ds   mm/dd/yys   %es   %2ds,   day of month as number, blank padded ( 0-31)s   %hs   abbreviated month names   %ki   s   hour, blank padded ( 0-23)s   %ns   
s   newline characters   %rs   %02d:%02d:%02d %si   i   s   %I:%M:%S %ps   %Rs	   %02d:%02ds   %H:%Ms   seconds since the Epoch in UCTs   %ts   	s   tab characters   %Ts   %02d:%02d:%02ds   %H:%M:%Ss   %3ys   %03ds.   year without century rendered using fieldwidths*   Error for nonstandard '%s' format (%s): %ss%   Supports nonstandard '%s' format (%s)R   s+   Does not appear to support '%s' format (%s)s*   Conflict for nonstandard '%s' format (%s):s     Expected %s, but got %s(   s   %ns   
s   newline character(   s   %ts   	s   tab character(   t   strt   longR!   R   R   t   asctimeR   R=   R@   R    R   RB   RC   R    R2   R   RE   R   (   R   R!   t   nowsecst   nonstandard_expectationsRG   RH   t   msg(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyR1      sN    	#)$%	"			(   t   __name__t
   __module__R   R"   R/   R;   R0   R1   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyR      s   			
		0c           C   s   t  j t  d  S(   N(   R    t   run_unittestR   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt	   test_mainˇ   s    t   __main__(   t   __doc__R=   R3   R   t   testR    R   R   R   R   R   R   RS   RP   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_strftime.pyt   <module>   s   			