ó
'![c        	   @   s  d  Z  d d l Z d d l m Z d d l Z e j j d d e f d e f d e f d e f d	 e f d
 e f g ƒ d „  ƒ Z	 e j j d d i d d 6f d i d d 6f g ƒ d „  ƒ Z
 e j j d d i d d 6f d i d d 6f g ƒ d „  ƒ Z d „  Z d „  Z d „  Z d S(   s+   Tests for the pylint.checkers.utils module.iÿÿÿÿN(   t   utilss   name,expectedt   mint   __builtins__t   __path__t   __file__t   whatevert	   mybuiltinc         C   s   t  j |  ƒ | k s t ‚ d  S(   N(   R    t
   is_builtint   AssertionError(   t   namet   expected(    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   testIsBuiltin   s    	s   fn,kws   foo(3)t   bart   keywords   foo(one=a, two=b, three=c)i   t   positionc         C   s<   t  j t j ƒ $ t j |  ƒ } t j | |  Wd  QXd  S(   N(   t   pytestt   raisesR    t   NoSuchArgumentErrort   astroidt   extract_nodet   get_argument_from_call(   t   fnt   kwt   node(    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   testGetArgumentFromCallError   s    s
   foo(bar=3)s   foo(a, b, c)c         C   s1   t  j |  ƒ } t j | |  d  k	 s- t ‚ d  S(   N(   R   R   R    R   t   NoneR   (   R   R   R   (    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   testGetArgumentFromCallExists)   s    c       	   C   sÑ   t  j d ƒ }  t j |  d d d d ƒ} d | j k s? t ‚ t  j d ƒ }  t j t j ƒ  t j |  d d ƒWd  QXt j t	 ƒ  t j |  d  d  ƒ Wd  QXt j |  d d ƒ} | j d	 k sÍ t ‚ d  S(
   Ns"   foo(a, not_this_one=1, this_one=2)R   i   R   t   this_ones   foo(a)i   i    t   a(   R   R   R    R   t   valueR   R   R   R   t
   ValueErrorR   R	   (   R   t   argR	   (    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   testGetArgumentFromCall2   s    c          C   s¤   t  j d ƒ }  t j |  d t ƒ s+ t ‚ t j |  d t f ƒ sJ t ‚ t j |  d t ƒ sg t ‚ t j |  d t ƒ sƒ t ‚ t j |  d t ƒ s  t ‚ d  S(   Ns‘   
    try: pass
    except AttributeError: #@
         pass
    try: pass
    except Exception: #@
         pass
    except: #@
         pass
    i    i   i   (   R   R   R    t   error_of_typet   AttributeErrorR   t	   Exceptiont   ImportError(   t   nodes(    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   test_error_of_type@   s    		c          C   s†   t  j d ƒ }  t j |  d t ƒ s+ t ‚ t j |  d t ƒ sH t ‚ t j |  d t ƒ se t ‚ t j |  d t ƒ s‚ t ‚ d  S(   Nsð   
    try:
        1/0 #@
    except ZeroDivisionError:
        pass
    try:
        1/0 #@
    except Exception:
        pass
    try:
        2/0 #@
    except:
        pass
    try:
        1/0 #@
    except ValueError:
        pass
    i    i   i   i   (   R   R   R    t   node_ignores_exceptiont   ZeroDivisionErrorR   (   R%   (    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   test_node_ignores_exceptionR   s    	(   t   __doc__R   t   pylint.checkersR    R   t   markt   parametrizet   Truet   FalseR   R   R   R    R&   R)   (    (    (    sB   lib/python2.7/site-packages/pylint/test/unittest_checkers_utils.pyt   <module>   s&   					""		