ó
ŠwÛjc           @   sK  d  d l  Z e j j d d e ƒZ d  d l m Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l m Z d  d l m Z d Z d	 e f d
 „  ƒ  YZ d e j f d „  ƒ  YZ e j j e j j e j j f Z d d d „  ƒ  YZ d \ Z Z d \ Z Z g  e e d ƒ e d d ƒ ƒ D] \ Z Z  e e  f ^ q$Z! e! d e! d d !i d d 6Z i  Z d „  e e d ƒ e d d ƒ ƒ Dƒ Z d „  e d ƒ Dƒ Z" d h Z" d  Z# d! Z# g  Z! d d g Z! e! rÖn e e Z Z y	 e$ GHWn d Z$ n Xe$ d 7Z$ z e e 7Z Wd d Z Xd  d l% Td „  Z& e' d k rGe& ƒ  n  d S("   iÿÿÿÿNt   compilert
   deprecated(   t   flatten(   t   random(   t   StringIOi   i<   t   TrivialContextc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   |  S(   N(    (   t   self(    (    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_compiler.pyt	   __enter__   s    c         G   s   d  S(   N(    (   R   t   exc_info(    (    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_compiler.pyt   __exit__   s    (   t   __name__t
   __module__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_compiler.pyR      s   	t   CompilerTestc           B   sà   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 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s²  t  j  ƒ  t } t j j t j ƒ } t j j } xz| g D]o} xfd D]^} | t  j  ƒ  k r� t  j  ƒ  t } t	 j
 d IJt	 j
 j ƒ  n  | j d ƒ s¢ qH n  t r¾ t ƒ  d k  r¾ qH n  t j j | | ƒ } t j j rë d G| GHn  t | d ƒ } | j ƒ  } | j ƒ  d | k s(d | k rG|  j t t j | | d	 ƒ qH y t j | | d	 ƒ WqH t k
 r¥}	 t |	 j ƒ }
 |
 j d
 | ƒ t |
 ƒ |	 _ ‚  qH XqH Wq; Wd  S(   Ns
   test_os.pys1     testCompileLibrary still working, be patient...s   .pyg\�Âõ(\ï?t	   compilingt   Ut	   badsyntaxt
   bad_codingt   execs   in file %s](   s
   test_os.py(   t   timet   _PRINT_WORKING_MSG_INTERVALt   ost   patht   dirnamet   __file__t   testt   test_supportt   TEST_HOME_DIRt   syst
   __stdout__t   flusht   endswitht   TEST_ALLR   t   joint   verboset   opent   readt   closet   assertRaisest   SyntaxErrorR    t   compilet	   Exceptiont   listt   argst   appendt   tuple(   R   t	   next_timet   libdirt   testdirt   dirt   basenameR   t   ft   buft   eR*   (    (    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_compiler.pyt   testCompileLibrary   s<    
c         C   s   t  j d d d ƒ d  S(   Ns   class foo():pass

s   <string>R   (   R    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_compiler.pyt   testNewClassSyntax?   s    c         C   s   t  j d d d ƒ d  S(   Ns   def g(): yield

s   <string>R   (   R    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_compiler.pyt   testYieldExprB   s    c            sc   ‡  f d †  } e  j d d d ƒ } | i | d 6Uˆ  j e e  j d ƒ ˆ  j e e  j d ƒ d  S(   Nc             s.   ˆ  j  |  | f d i d d 6d d 6f ƒ d  S(   Ni   i   i   t   xi   t   y(   i   i   (   t   assertEqual(   R*   t   kwargs(   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_compiler.pyR2   F   s    s   f(x=1, *(2, 3), y=4)s   <string>R   R2   s   foo(a=1, b)s   foo(1, *args, 3)(   R    R'   R%   R&   t   parse(   R   R2   t   c(    (   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_compiler.pyt   testKeywordAfterStarargsE   s
    c         B   sY   e  j d d d ƒ } i  } | | U|  j | j d ƒ d ƒ |  j | j d ƒ d ƒ d  S(   Ns)   try:
 1//0
except:
 e = 1
finally:
 f = 1s   <string>R   R4   i   R2   (   R    R'   R:   t   get(   R   R=   t   dct(    (    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_compiler.pyt   testTryExceptFinallyN   s    	c         C   s   |  j  t t j d ƒ d  S(   Ns   def foo(a=1, b): pass(   R%   R&   R    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_compiler.pyt   testDefaultArgsW   s    c         B   sf   e  j d d d ƒ } |  j d | j ƒ e  j d d d ƒ } i  } | | U|  j | d j d ƒ d  S(   Ns   "doc"s   <string>R   t   __doc__s   def f():
 "doc"R2   t   doc(   R    R'   t   assertInt   co_namesR:   RC   (   R   R=   t   g(    (    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_compiler.pyt   testDocstringsZ   s    c         C   sB   t  } | j d ƒ r" | d  } n  t j | ƒ } |  j | ƒ d  S(   Ns   .pycs   .pyoiÿÿÿÿ(   s   .pycs   .pyo(   R   R   R    t	   parseFilet   check_lineno(   R   t   filenamet   tree(    (    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_compiler.pyt
   testLineNob   s
    c         C   s;   y |  j  | ƒ Wn# t k
 r6 | j G| j GH‚  n Xd  S(   N(   t   _check_linenot   AssertionErrort	   __class__t   lineno(   R   t   node(    (    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_compiler.pyRJ   j   s
    c         C   s‰   | j  t k ra |  j | j t d | j | j  f ƒ |  j | j d k d | j | j  f ƒ n  x! | j ƒ  D] } |  j | ƒ qn Wd  S(   Ns   lineno=%s on %si    (   RP   t   NOLINENOt   assertIsInstanceRQ   t   intt
   assertTruet   getChildNodesRJ   (   R   RR   t   child(    (    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_compiler.pyRN   q   s    c         C   sK   |  j  t d d g g ƒ d d g ƒ |  j  t d d f ƒ d d g ƒ d  S(   Ni   i   (   i   (   R:   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_compiler.pyt   testFlattenz   s    %c         B   s@   e  j d d d ƒ } i  } | | U|  j | j d ƒ d ƒ d  S(   NsH   def g():
    a = 1
    def f(): return a + 2
    return f()
result = g()s   <string>R   t   resulti   (   R    R'   R:   R?   (   R   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_compiler.pyt   testNestedScope~   s    		c         C   s8   t  j d d d ƒ } |  j t | ƒ d d	 d
 g ƒ d  S(   NsK   list((i,j) for i in range(3) if i < 3           for j in range(4) if j > 2)s   <string>t   evali    i   i   i   (   i    i   (   i   i   (   i   i   (   R    R'   R:   R\   (   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_compiler.pyt
   testGenExpŠ   s    		c         C   sl   t  j d d d ƒ } |  j t | ƒ d d d h ƒ t  j d d d ƒ } |  j t | ƒ d d d h ƒ d  S(   Ns	   {1, 2, 3}s   <string>R\   i   i   i   s
   {1, 2, 3,}(   R    R'   R:   R\   (   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_compiler.pyt   testSetLiteral‘   s    c         C   s„   t  j d d d ƒ } |  j t | ƒ i d d 6d d 6d d 6ƒ t  j d d d ƒ } |  j t | ƒ i d d 6d d 6d d 6ƒ d  S(	   Ns   {1:2, 2:3, 3:4}s   <string>R\   i   i   i   i   s   {1:2, 2:3, 3:4,}(   R    R'   R:   R\   (   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_compiler.pyt   testDictLiteral—   s    +c         C   sr   t  j d d d ƒ } |  j t | ƒ d d d h ƒ t  j d d d ƒ } |  j t | ƒ d d d d d	 h ƒ d  S(
   Ns   {x for x in range(1, 4)}s   <string>R\   i   i   i   sE   {x * y for x in range(3) if x != 0       for y in range(4) if y != 0}i   i   (   R    R'   R:   R\   (   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_compiler.pyt   testSetComp�   s    		c         C   s}   t  j d d d ƒ } |  j t | ƒ i d d 6d d 6d d 6ƒ t  j d d d ƒ } |  j t | ƒ i d d	 6d d
 6ƒ d  S(   Ns   {x:x+1 for x in range(1, 4)}s   <string>R\   i   i   i   i   sO   {(x, y) : y for x in range(2) if x != 0            for y in range(3) if y != 0}(   i   i   (   i   i   (   R    R'   R:   R\   (   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_compiler.pyt   testDictComp¦   s    +		c         B   sG   e  j d d d ƒ } i e d 6} | | U|  j | j d ƒ d ƒ d  S(   Nsg   from __future__ import with_statement
def f():
    with TrivialContext():
        return 1
result = f()s   <string>R   R   RZ   i   (   R    R'   R   R:   R?   (   R   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_compiler.pyt   testWith¯   s    		c         B   sG   e  j d d d ƒ } i e d 6} | | U|  j | j d ƒ d ƒ d  S(   Nsm   from __future__ import with_statement
def f():
    with TrivialContext() as tc:
        return 1
result = f()s   <string>R   R   RZ   i   (   R    R'   R   R:   R?   (   R   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_compiler.pyt   testWithAss¼   s    		c            s|   g  ‰  d d	 ‡  f d †  ƒ  Y} e  j d d d ƒ } i | d 6} | | U|  j | j d ƒ d ƒ |  j ˆ  d d g ƒ d  S(
   Nt   Ctxc              s)   e  Z d  „  Z ‡  f d †  Z d „  Z RS(   c         S   s   | |  _  d  S(   N(   t   n(   R   Re   (    (    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_compiler.pyt   __init__Ë   s    c            s   ˆ  j  |  j ƒ d  S(   N(   R+   Re   (   R   (   t   events(    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_compiler.pyR   Í   s    c         W   s   d  S(   N(    (   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_compiler.pyR	   Ï   s    (   R
   R   Rf   R   R	   (    (   Rg   (    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_compiler.pyRd   Ê   s   	sr   from __future__ import with_statement
def f():
    with Ctx(1) as tc, Ctx(2) as tc2:
        return 1
result = f()s   <string>R   RZ   i   i   (    (   R    R'   R:   R?   (   R   Rd   R=   R@   (    (   Rg   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_compiler.pyt   testWithMultÈ   s    		c         B   sO   e  j d d d ƒ } i i  d 6} i  } | | | U|  j | j d ƒ d ƒ d  S(   Ns   global x
x=1s   <string>R   t   __builtins__R8   i   (   R    R'   R:   R?   (   R   t   codet   d1t   d2(    (    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_compiler.pyt
   testGlobalÝ   s
    
c         B   sK   e  j d d d ƒ } i e ƒ  d 6} | | U|  j | d j ƒ  d ƒ d  S(   NsV   from __future__ import print_function
print("a", "b", sep="**", end="++", file=output)s   <string>R   t   outputs   a**b++(   R    R'   R   R:   t   getvalue(   R   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_compiler.pyt   testPrintFunctionå   s    		c         C   sT   y t  | d d ƒ Wn9 t k
 rO } |  j | j | ƒ |  j | j | ƒ n Xd  S(   Nt    R   (   R'   R&   R:   t   offsett   text(   R   t   srcRs   Rr   R4   (    (    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_compiler.pyt   _testErrEncï   s
    c         C   sj   d } d } d } |  j  | | d ƒ |  j  | | | d ƒ |  j  | | | d ƒ |  j  | | d ƒ d  S(   Ns   print 'ƒpƒCƒ\ƒ“', '
s   print '12345678', '
s   #! -*- coding: ShiftJIS -*-
i   (   Ru   (   R   t   sjist   asciit   encdef(    (    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_compiler.pyt   testSourceCodeEncodingsErrorö   s    (   R
   R   R5   R6   R7   R>   RA   RB   RH   RM   RJ   RN   RY   R[   R]   R^   R_   R`   Ra   Rb   Rc   Rh   Rm   Rp   Ru   Ry   (    (    (    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_compiler.pyR      s0   	,																										
	t   Totoc           B   s   e  Z d  Z RS(   t	   docstring(   R
   R   RC   (    (    (    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_compiler.pyRz     s   i   i   i   i
   i    i   t   ac         C   s   i  |  ] \ } } | | “ q S(    (    (   t   .0R8   R9   (    (    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_compiler.pys
   <dictcomp>  s   	 c         C   s   h  |  ] } | ’ q S(    (    (   R}   R8   (    (    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_compiler.pys	   <setcomp>  s   	 i   (   t   *c           C   s&   t  j j d ƒ a t  j j t ƒ d  S(   Nt   cpu(   R   R   t   is_resource_enabledR   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_compiler.pyt	   test_main7  s    t   __main__i,  (    (   i   i   (   i   i   (    (   i   i   ((   t   test.test_supportR   R   t   import_modulet   TrueR    t   compiler.astR   R   R   R   t   unittestR   R   R   t   objectR   t   TestCaseR   t   astt   Modulet   Stmtt   DiscardRS   Rz   R|   t   bR=   t   dt   zipt   rangeR8   R9   t   lt   st   tt   yot   mathR‚   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_compiler.pyt   <module>   sN   0ø!=(		


	