ó
'![c           @   sp   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z m	 Z	 d e f d „  ƒ  YZ
 d S(   s%   Unit tests for the variables checker.iÿÿÿÿN(   t   classes(   t   CheckerTestCaset   Messaget
   set_configt   TestVariablesCheckerc           B   si   e  Z e j Z d  „  Z e d d ƒ d „  ƒ Z e j	 j
 e j d d k d d ƒd	 „  ƒ Z d
 „  Z RS(   c         C   sf   t  j d ƒ \ } } t d d | j d d | j f ƒ} |  j | ƒ  |  j | j ƒ  ƒ Wd QXd S(   sE   Issue 164 report a false negative for access-member-before-definitions…   
        class MyClass1(object):
          def __init__(self):
            self.first += 5 #@
            self.first = 0  #@
        s   access-member-before-definitiont   nodet   argst   firstN(   t   astroidt   extract_nodeR   t   targett   linenot   assertAddsMessagest   walkt   root(   t   selft   n1t   n2t   message(    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyt   test_bitbucket_issue_164   s    	t   exclude_protectedt   _metat   _managerc         C   sX   t  j d ƒ } |  j t d d | j d j d d ƒƒ  |  j | j ƒ  ƒ Wd QXd S(   sh   Test that exclude-protected can be used to
        exclude names from protected-access warning.
        s  
        class Protected(object):
            '''empty'''
            def __init__(self):
                self._meta = 42
                self._manager = 24
                self._teta = 29
        OBJ = Protected()
        OBJ._meta
        OBJ._manager
        OBJ._teta
        s   protected-accessR   iÿÿÿÿR   t   _tetaN(   R   t   parseR   R   t   bodyt   valueR   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyt   test_exclude_protected$   s    		i    i   t   reasons   The test works on Python 3.c         C   s6   t  j d ƒ } |  j ƒ   |  j j | ƒ Wd  QXd  S(   Ns¦   
        from tracemalloc import Sequence
        class _Traces(Sequence):
            def __init__(self, traces): #@
                Sequence.__init__(self)
        (   R   R	   t   assertNoMessagest   checkert   visit_functiondef(   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyt2   test_regression_non_parent_init_called_tracemalloc<   s    	c         C   s6   t  j d ƒ } |  j ƒ   |  j j | ƒ Wd  QXd  S(   Nsª   
        import ctypes

        class Foo(ctypes.BigEndianStructure):
            def __init__(self): #@
                ctypes.BigEndianStructure.__init__(self)
        (   R   R	   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyt%   test_super_init_not_called_regressionK   s    	(   R   R   (   t   __name__t
   __module__R    t   ClassCheckert   CHECKER_CLASSR   R   R   t   pytestt   markt   skipift   syst   version_infoR    R!   (    (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyR      s   		(   t   __doc__R)   R&   R   t   pylint.checkersR    t   pylint.testutilsR   R   R   R   (    (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_classes.pyt   <module>
   s   