ó
'![c           @   sç  d  Z  d d l Z d d l Z d d l Z d d l m Z m Z m Z d d l m	 Z	 m
 Z
 e j d k Z d e j d  Z e e e e ƒ ƒ d ƒ Z e e e e ƒ ƒ d	 ƒ Z d Z e Z e j d
 ƒ Z e j d k râ d n d Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z e j j d e e ƒ d g  e e ƒ D] Z e d ^ qKƒd „  ƒ Z  e! d k rãd e j" k r¡e# Z e j" j$ d ƒ n  e% e j" ƒ d k rÐe j" d Z e j" d =n  e j& e j" ƒ n  d S(   s*   functional/non regression tests for pylintiÿÿÿÿN(   t   abspatht   dirnamet   join(   t   _get_tests_infot   linteri   i    s   %d%d%dt   inputt   messagess   ^func_i\d\d\d\d$t   't    c         C   s   d | j  d j | j ƒ f S(   sF   function used to replace default __str__ method of exception instancess   in %s
:: %ss   , (   t   fileR   t   args(   t   selft   ex(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   exception_str(   s    t   LintTestUsingModulec           B   se   e  Z d Z d  Z e Z e Z d Z d Z d Z	 d Z
 d „  Z d „  Z d „  Z d „  Z d „  Z RS(   R   t   modulec         C   sq   |  j  d |  j g } |  j r` | g  |  j D]) \ } } |  j  d | j d d ƒ ^ q- 7} n  |  j | ƒ d  S(   Nt   .s   .%ss   .pyR   (   t   packageR   t   dependst   replacet   _test(   R   t   tocheckt   namet   _(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   _test_functionality;   s
    	:c         C   s0   |  j  ƒ  j ƒ  d | j ƒ  d k s, t ‚ d  S(   Ns   
(   t   _get_expectedt   stript   AssertionError(   R   t   got(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   _check_resultC   s    c         C   s¦   t  j |  j ƒ r% |  j j d ƒ n |  j j d ƒ y |  j j | ƒ Wn= t k
 rˆ } |  j j j	 ƒ  | | _
 | GHt | _ ‚  n X|  j |  j j j	 ƒ  ƒ d  S(   Nt   I(   t   INFO_TEST_RGXt   matchR   R   t   enablet   disablet   checkt	   Exceptiont   reportert   finalizeR	   R   t   __str__R   (   R   R   R   (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyR   F   s    		c         C   s   |  j  j d ƒ S(   Nt   func_noerror_(   R   t
   startswith(   R   (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   _has_outputV   s    c         C   sO   |  j  ƒ  rG |  j rG t |  j d ƒ  } | j ƒ  j ƒ  d SWd  QXn d Sd  S(   Nt   Us   
R   (   R*   t   outputt   opent   readR   (   R   t   fobj(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyR   Y   s    N(   t   __name__t
   __module__t   Nonet	   INPUT_DIRt   DEFAULT_PACKAGER   R   R   R   R,   t
   _TEST_TYPER   R   R   R*   R   (    (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyR   -   s   				t   LintTestUpdatec           B   s   e  Z d  Z d „  Z RS(   t   updatec         C   st   |  j  ƒ  rp y |  j ƒ  } Wn t k
 r5 d } n X| | k rp t |  j d ƒ  } | j | ƒ Wd  QXqp n  d  S(   NR   t   w(   R*   R   t   IOErrorR-   R,   t   write(   R   R   t   expectedR/   (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyR   e   s    
(   R0   R1   R5   R   (    (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyR6   a   s   c         C   sè   |  r t  j |  ƒ j } n	 d „  } g  } x t t t d d ƒ D]x \ } } | | ƒ s@ | j d ƒ rn q@ n  | j d d ƒ j d ƒ d } t t t | d ƒ } | j	 | | | f ƒ q@ Wt
 rÆ | St | ƒ d	 k  sä t d
 ƒ ‚ | S(   Nc         S   s   d S(   Ni   (    (   t   x(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   <lambda>t   s    t   func_R   s   .pycs	   $py.classs   .pyR   i   iÄ   s&   Please do not add new test cases here.(   s   .pycs	   $py.class(   t   ret   compilet   searchR   R3   t   MSG_DIRt   endswithR   t   splitt   appendt   UPDATEt   lenR   (   t
   filter_rgxt	   is_to_runt   testst   module_filet   messages_filet   baset   dependencies(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt	   gen_testsp   s    	s&   module_file,messages_file,dependenciest   idsc         C   s\   t  r t ƒ  n t ƒ  } |  j d d ƒ | _ | | _ | p? d  | _ t | _ | j	 ƒ  d  S(   Ns   .pyR   (
   RF   R6   R   R   R   R,   R2   R   R3   R   (   RK   RL   RN   t   LT(    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   test_functionality†   s    		t   __main__s   -ui   (   i   i    (   i   i   ('   t   __doc__t   sysR?   t   pytestt   os.pathR    R   R   t   pylint.testutilsR   R   t   version_infot   PY3Kt   SYS_VERS_STRt   __file__R3   RB   R2   t
   FILTER_RGXt   FalseRF   R@   R   t   quoteR   t   objectR   R6   RO   t   markt   parametrizet   oRR   R0   t   argvt   Truet   removeRG   t   main(    (    (    s4   lib/python2.7/site-packages/pylint/test/test_func.pyt   <module>   s6   	4	/