ó
‹wÛjc           @   sÖ   d  Z  d d l Z d d l Z d d l Z d d l m Z e j Z d Z	 d Z
 d Z e j ƒ  Z e j Z d j ƒ  Z e j j e ƒ Z d Z d	 Z d
 Z d e j f d „  ƒ  YZ d „  Z e d k rÒ e ƒ  n  d S(   s     Tests for the linecache module iÿÿÿÿN(   t   supports
   !@$)(!@#_1t    s,   inspect_fodder inspect_fodder2 mapping_testss   linecache abcs3   
" Docstring "

def function():
    return result

s%   
def f():
    return 1 + 1

a = f()

s   
def f():
    return 3t   LineCacheTestsc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sz  t  j } |  j | t d ƒ t ƒ |  j | t d ƒ t ƒ |  j t | t d ƒ |  j | t d ƒ t ƒ |  j | t d ƒ t ƒ xg t D]_ } t	 j
 j t | ƒ d } x= t t | ƒ ƒ D]) \ } } |  j | | | | d ƒ ƒ q¼ WqŠ Wxg t D]_ } t	 j
 j t | ƒ d } x= t t | ƒ ƒ D]) \ } } |  j | | | | d ƒ ƒ q&Wqô Wt  j d ƒ } |  j | g  ƒ d  S(	   Ni   i   iÿÿÿÿgš™™™™™ñ?i   s   .pys   a/b/c/__init__.pyi €  (   t	   linecachet   getlinet   assertEqualt   FILENAMEt   EMPTYt   assertRaisest	   TypeErrort   INVALID_NAMEt   TESTSt   ost   patht   joint	   TEST_PATHt	   enumeratet   opent   MODULESt   MODULE_PATHt   getlines(   t   selfR   t   entryt   filenamet   indext   linet   empty(    (    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_linecache.pyt   test_getline)   s     	%%c         C   sm   |  j  t j t j ƒ t t j d ƒ � } | j t ƒ Wd  QXt j t j ƒ } |  j	 | d d d g ƒ d  S(   Nt   ws   
s	   def f():
s       return 3
(
   t
   addCleanupR    t   unlinkt   TESTFNR   t   writet   SOURCE_3R   R   R   (   R   t   fpt   lines(    (    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_linecache.pyt   test_no_ending_newlineG   s
    c         C   sË   g  } xD t  D]< } t j j t | ƒ d } | j | ƒ t j | d ƒ q Wg  | D] } | t j k rT | ^ qT } |  j	 | g  ƒ t j
 ƒ  g  | D] } | t j k r– | ^ q– } |  j	 | g  ƒ d  S(   Ns   .pyi   (   R   R   R   R   R   t   appendR   R   t   cacheR   t
   clearcache(   R   t   cachedR   R   t   fnt   cached_empty(    (    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_linecache.pyt   test_clearcacheN   s    (
(c         C   s–  t  j } t j d } |  j t j | ƒ t | d ƒ � } | j t ƒ Wd  QX| | d ƒ g  } t | ƒ �N } xD t	 | ƒ D]6 \ } } |  j
 | | | | d ƒ ƒ | j | ƒ q} WWd  QXt | d ƒ � } | j t ƒ Wd  QXt  j d ƒ x7 t	 | ƒ D]) \ } } |  j
 | | | | d ƒ ƒ qü Wt  j | ƒ t | ƒ �N } xD t	 | ƒ D]6 \ } } |  j
 | | | | d ƒ ƒ | j | ƒ qRWWd  QXd  S(   Ns   .pyR   i   t   dummy(   R   R   R    R   R   R   R   R    t   SOURCE_1R   R   R%   t   SOURCE_2t
   checkcache(   R   R   t   source_namet   sourcet   source_listR   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_linecache.pyt   test_checkcache^   s*    	!c         C   sÂ   t  j t ƒ } |  j | ƒ d „  } t j t  d | ƒ � t  j t ƒ } Wd  QX|  j | | ƒ t  j ƒ  t j t  d | ƒ � t  j t ƒ } Wd  QX|  j | g  ƒ |  j t  j t ƒ | ƒ d  S(   Nc          _   s
   t  ‚ d  S(   N(   t   MemoryError(   t   argst   kwargs(    (    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_linecache.pyt   raise_memoryerror‚   s    t   updatecache(   R   R   R   t
   assertTrueR    t	   swap_attrR   R'   (   R   R#   R7   t   lines2t   lines3(    (    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_linecache.pyt   test_memoryerror   s    	
(   t   __name__t
   __module__R   R$   R+   R3   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_linecache.pyR   '   s
   				!c           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_linecache.pyt	   test_main�   s    t   __main__(   t   __doc__R   t   unittestt   os.pathR   t   testR    t   __file__R   R
   R   R   t   splitt   TEST_HOME_DIRR   R   R   t   dirnameR   R-   R.   R!   t   TestCaseR   RA   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_linecache.pyt   <module>   s&   		h	