ó
î%![c           @   s¥  d  Z  d d l Z d d l Z d d l m Z d d l Z d d l m Z d d l m Z d d l m	 Z	 d d l m
 Z
 d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d d	 l m Z m Z m Z m Z m Z d d
 l m Z d d l m Z d d l m Z d „  Z d e j  f d „  ƒ  YZ! d e! e j" f d „  ƒ  YZ# d e! e j" f d „  ƒ  YZ$ d e! e j" f d „  ƒ  YZ% e& d k r¡e j' ƒ  n  d S(   sW   tests for specific behaviour of astroid scoped nodes (i.e. module, class and
function)
iÿÿÿÿN(   t   partial(   t   builder(   t   nodes(   t   scoped_nodes(   t   util(	   t   InferenceErrort   AttributeInferenceErrort	   NoDefaultt   ResolveErrort   MroErrort   InconsistentMroErrort   DuplicateBasesErrort   TooManyLevelsErrort   NameInferenceError(   t   BUILTINSt   Instancet   BoundMethodt   UnboundMethodt	   Generator(   t   __pkginfo__(   t
   test_utils(   t	   resourcesc         C   sT   |  j  | | | | ƒ |  j | | ƒ | j ƒ  | j ƒ  | j ƒ  t | ƒ d  S(   N(   t   assertIst   assertInt   keyst   valuest   itemst   iter(   t   selft   nodet	   test_attr(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   _test_dict_interface'   s    


t   ModuleLoaderc           B   s   e  Z d  „  Z RS(   c         C   sk   t  t |  ƒ j ƒ  t j d d ƒ |  _ t j d d ƒ |  _ t j d d ƒ |  _ t j d d ƒ |  _ d  S(	   Ns   data/module.pys   data.modules   data/module2.pys   data.module2s   data/nonregr.pys   data.nonregrs   data/__init__.pyt   data(	   t   superR    t   setUpR   t
   build_filet   modulet   module2t   nonregrt   pack(   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR#   1   s
    (   t   __name__t
   __module__R#   (    (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR    0   s   t   ModuleNodeTestc           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 RS(   c         C   sô  |  j  t |  j j d ƒ ƒ d ƒ |  j |  j j d ƒ d t j ƒ |  j  |  j j d ƒ d j d ƒ |  j  t |  j j d ƒ ƒ d ƒ |  j |  j j d ƒ d t j ƒ |  j  |  j j d ƒ d j d ƒ |  j  t |  j j d ƒ ƒ d ƒ |  j |  j j d ƒ d t j ƒ |  j  |  j j d ƒ d j t j	 j
 t j d ƒ ƒ ƒ |  j  t |  j j d	 ƒ ƒ d ƒ |  j |  j j d	 ƒ d t j ƒ |  j t |  j j d
 ƒ |  j  t |  j j d
 ƒ ƒ d ƒ |  j |  j j d
 ƒ d t j ƒ d  S(   NR)   i   i    s   data.modulet   __doc__s   test module for astroid
t   __file__s   data/module.pyt   __dict__t   __path__(   t   assertEqualt   lenR%   t   getattrt   assertIsInstanceR   t   Constt   valuet   ost   patht   abspathR   t   findt   Dictt   assertRaisesR   R(   t   List(   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_special_attributes;   s    "##"##"#"#"c         C   s   t  |  |  j d ƒ d  S(   Nt   YO(   R   R%   (   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_dict_interfaceL   s    c         C   su  |  j  j d ƒ d } |  j | t j ƒ |  j | j d ƒ t |  j  j d ƒ ƒ } |  j | t j	 ƒ |  j | j d ƒ t |  j  j d ƒ ƒ } |  j | t j ƒ |  j | j d ƒ t
 j d d ƒ } t | j d	 ƒ ƒ } t | j d
 ƒ ƒ } |  j | j t j ƒ |  j | j d
 ƒ |  j | j ƒ  j d ƒ |  j t |  j j d ƒ ƒ d ƒ |  j t |  j j d ƒ d  S(   NR>   i    t   redirectt	   four_argst   NameNodet   Names   data/appl/myConnection.pys   data.appl.myConnectiont   SSL1t
   Connections   data.SSL1.Connection1t	   enumeratei   t   YOAA(   R%   R2   R3   R   t   ClassDefR0   t   namet   nextt   igetattrt   FunctionDefR   R$   t	   __class__t   rootR1   R'   R;   R   (   R   t   yot   redt   namenodet   modt   sslt   cnx(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_getattrO   s$    		"c         C   su   t  j d d ƒ } |  j | j ƒ  d d d g ƒ t  j d d ƒ } t | j ƒ  ƒ } |  j | d d d d	 g ƒ d  S(
   Ns   data/all.pyt   allt   Aaat   _blaRI   s   data/notall.pyt   notallt   funct   other(   R   R$   R0   t   wildcard_import_namest   sorted(   R   t   mt   res(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_wildcard_import_namesd   s
    c         C   sæ   t  j d ƒ } t d d d d g ƒ } |  j t | j ƒ  ƒ | ƒ t  j d ƒ } t | j ƒ  ƒ } |  j | | ƒ t  j d ƒ } t | j ƒ  ƒ } |  j | d d	 g ƒ t  j d
 ƒ } t | j ƒ  ƒ } |  j | d d	 g ƒ d  S(   Ns¡   
        name = 'a'
        _bla = 2
        other = 'o'
        class Aaa: pass
        def func(): print('yo')
        __all__ = 'Aaa', '_bla', 'name'
        RW   RI   R[   RZ   sz   
        name = 'a'
        _bla = 2
        other = 'o'
        class Aaa: pass

        def func(): return 'yo'
        sx   
            from missing import tzop
            trop = "test"
            __all__ = (trop, "test1", tzop, 42)
        t   tropt   tzopsT   
            test = tzop = 42
            __all__ = ('test', ) + ('tzop', )
        t   test(   R   t   parseR]   R0   t   public_names(   R   R^   R   R_   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_public_namesk   s     				c         C   sG   d } t  j | t ƒ } |  j t | j d ƒ ƒ d | j d ƒ ƒ d  S(   NsV   
            appli = application
            appli += 2
            del appli
        t   applii   (   R   Rd   R)   R0   R1   R2   (   R   R!   t   astroid(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_module_getattr   s    c         C   sJ  t  j d d ƒ } t | _ | j d d ƒ } |  j | d ƒ | j d d ƒ } |  j | d ƒ | j d d ƒ } |  j | d ƒ | j d	 d ƒ } |  j | d ƒ t  j d
 d ƒ } t | _ | j d d ƒ } |  j | d ƒ | j d d ƒ } |  j | d ƒ | j d d ƒ } |  j | d ƒ | j d	 d ƒ } |  j | d ƒ d  S(   Ns   very.multi.packaget   doct   utilsi   s   very.multi.package.utilsi   s   very.multi.utilsi    t    s   very.multi.modules
   very.utilss
   very.multi(   R   t   Modulet   Truet   packaget   relative_to_absolute_nameR0   t   False(   R   RR   t   modname(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_relative_to_absolute_name›   s(    		c         C   s   t  j d d ƒ } t | _ xn d
 D]f } |  j t ƒ  } | j d | ƒ Wd  QXd j d | d d	 | j ƒ } |  j	 | t
 | j ƒ ƒ q" Wd  S(   Ns   a.b.cRl   i   i   Rc   sB   Relative import with too many levels ({level}) for module {name!r}t   leveli   RI   (   i   i   (   R   Rm   Rn   Ro   R;   R   Rp   t   formatRI   R0   t   strt	   exception(   R   RR   Rt   t   cmt   expected(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt/   test_relative_to_absolute_name_beyond_top_level³   s    		c         C   s·   d } t  j j d t j d ƒ ƒ t j | d d ƒ } zn | j d d d ƒ} |  j | j	 d ƒ t
 | j d	 ƒ ƒ } |  j t | ƒ d ƒ |  j | d j	 d
 ƒ Wd  t  j d =Xd  S(   Ns   from . import subpackagei    R!   Ro   s   data/package/__init__.pyRl   Rt   i   t
   subpackages   package.subpackage(   t   sysR7   t   insertR   R9   R   Rd   t   import_moduleR0   RI   t   listRK   R1   (   R   R!   Rh   R^   t   inferred(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_import_1¿   s    c         C   s·   d } t  j | d d ƒ } t j j d t j d ƒ ƒ zn | j d d d ƒ} |  j | j	 d ƒ t
 | j d	 ƒ ƒ } |  j t | ƒ d ƒ |  j | d j	 d
 ƒ Wd  t j d =Xd  S(   Ns!   from . import subpackage as pouetRo   s   data/package/__init__.pyi    R!   Rl   Rt   i   t   pouets   package.subpackage(   R   Rd   R|   R7   R}   R   R9   R~   R0   RI   R   RK   R1   (   R   R!   Rh   R^   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_import_2Í   s    c         C   sM   d } t  j | d ƒ } | j ƒ  # } |  j | j ƒ  j ƒ  | ƒ Wd  QXd  S(   Ns!   irrelevant_variable is irrelevantt	   in_memory(   R   Rd   t   streamR0   t   readt   decode(   R   R!   Rh   R…   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_file_stream_in_memoryÛ   s    c         C   st   t  j d ƒ } t j ƒ  j | d ƒ } t | d ƒ 8 } | j ƒ  # } |  j | j ƒ  | j ƒ  ƒ Wd  QXWd  QXd  S(   Ns   data/all.pyRV   t   rb(	   R   R9   R   t   AstroidBuildert
   file_buildt   openR…   R0   R†   (   R   R7   Rh   t   file_ioR…   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_file_stream_physicalá   s
    c         C   sH   t  j d ƒ } t j ƒ  j | d ƒ } |  j t ƒ  | j Wd  QXd  S(   Ns   data/all.pyRV   (   R   R9   R   RŠ   R‹   R;   t   AttributeErrort   file_stream(   R   R7   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_file_stream_apiè   s    c         C   sŽ   t  j d ƒ } t j ƒ  j | d ƒ } | j ƒ  } |  j t | d ƒ ƒ | 9 t | d ƒ # } |  j	 | j
 ƒ  | j
 ƒ  ƒ Wd  QXWd  QXd  S(   Ns   data/all.pyRV   t   closeR‰   (   R   R9   R   RŠ   R‹   R…   t
   assertTruet   hasattrRŒ   R0   R†   (   R   R7   Rh   R…   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_stream_apiï   s    (   R)   R*   R=   R?   RU   R`   Rf   Ri   Rs   Rz   R   Rƒ   Rˆ   RŽ   R‘   R•   (    (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR+   9   s   					%								t   FunctionNodeTestc           B   sR  e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e	 j
 d ƒ 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 e	 j
 d d ƒ d „  ƒ Z e	 j
 d d ƒ d „  ƒ Z e	 j
 d d ƒ d „  ƒ Z e	 j
 d d ƒ d „  ƒ Z e	 j
 d d ƒ d „  ƒ Z RS(   c         C   s  |  j  d } |  j t | j d ƒ ƒ d ƒ |  j | j d ƒ d t j ƒ |  j | j d ƒ d j d ƒ |  j t | j d ƒ ƒ d ƒ |  j | j d ƒ d t j ƒ |  j | j d ƒ d j d ƒ |  j t |  j j d ƒ ƒ d ƒ |  j |  j j d ƒ d t j	 ƒ d  S(   Nt
   make_classR)   i   i    R,   s-   check base is correctly resolved to Concrete0R.   (
   R&   R0   R1   R2   R3   R   R4   R5   R%   R:   (   R   RZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR=   û   s       "c         C   s   t  |  |  j d d ƒ d  S(   Nt   global_accesst   local(   R   R%   (   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR?     s    c         C   s{   |  j  d } |  j | j j d ƒ t j ƒ |  j t | j j d ƒ |  j t | j j d ƒ |  j t | j j d ƒ d  S(   NR—   t   baset   argst   kwargst   any(   R&   R3   R›   t   default_valueR   t	   AttributeR;   R   (   R   RZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_default_value
  s
    c         C   s  |  j  d } |  j | j ƒ  | ƒ | j ƒ  } |  j | t j ƒ | j j d } |  j | | j ƒ  ƒ | j	 ƒ  } |  j | t j
 ƒ |  j | j d ƒ |  j | | j	 ƒ  ƒ | j	 ƒ  j	 ƒ  j	 ƒ  } |  j | t j ƒ |  j | j	 ƒ  ƒ | j ƒ  j d } |  j | j ƒ  ƒ d  S(   NR˜   i    R>   (   R%   R0   t	   statementt   previous_siblingR3   R   t   AssignR›   R   t   next_siblingRH   RI   t   assertIsNoneRN   t   body(   R   t   functiont	   l_siblingt   childt	   r_siblingt   lastt   first(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_navigation  s    c         C   s€   t  j d k r |  j d ƒ n  d } t j | ƒ } | d } |  j t | j ƒ d d d d	 g ƒ |  j | j j	 ƒ  d
 ƒ d  S(   Ni   i    s%   nested args has been removed in py3.xs\   
            def nested_args(a, (b, c, d)):
                "nested arguments test"
        t   nested_argst   at   bt   ct   ds   a, (b, c, d)(   i   i    (
   R|   t   version_infot   skipTestR   Rd   R0   R]   t   localsR›   t   format_args(   R   t   codet   treeRZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_nested_args&  s    
%c         C   sR   |  j  d } t | j ƒ  ƒ } |  j | d d d d g ƒ |  j | j d ƒ d  S(   NRA   R¯   R°   R±   R²   R§   (   R%   R]   R   R0   t   type(   R   RZ   R™   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_four_args2  s    c         C   sP   |  j  d } |  j | j j ƒ  d ƒ |  j d } |  j | j j ƒ  d ƒ d  S(   NR—   s)   any, base=data.module.YO, *args, **kwargsRA   s
   a, b, c, d(   R&   R0   R›   R¶   R%   (   R   RZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_format_args8  s
    s   3.0c         C   s9   t  j d ƒ j d j } | j ƒ  } |  j | d ƒ d  S(   Ns@   
        def test(a: int, *, b: dict):
            pass
        iÿÿÿÿs   a:int, *, b:dict(   R   Rd   R¦   R›   R¶   R0   (   R   R   t	   formatted(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt"   test_format_args_keyword_only_args?  s    c         C   sR   |  j  |  j d j ƒ  ƒ |  j |  j d j ƒ  ƒ |  j |  j d j ƒ  ƒ d  S(   Nt	   generatort   not_a_generatorR—   (   R“   R&   t   is_generatort   assertFalse(   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_is_generatorH  s    c         C   s®   |  j  d d } |  j | j d t ƒ ƒ |  j | j ƒ  d ƒ |  j | j ƒ  d t ƒ |  j  d d } |  j | j d t ƒ ƒ |  j  d } |  j | j d t ƒ ƒ d  S(   Nt   AbstractClasst   to_overridet   pass_is_abstracts&   data.module2.AbstractClass.to_overrides   %s.instancemethodt   return_somethingt   raise_string(	   R&   R“   t   is_abstractRq   R0   t   qnamet   pytypeR   RÂ   (   R   t   methodRZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_is_abstractM  s    c         C   sj   t  j d ƒ } |  j | d j d t ƒ ƒ |  j | d j d t ƒ ƒ |  j | d j d t ƒ ƒ d  S(   Ns¢  
            import abc

            class Klass(object):
                @abc.abstractproperty
                def prop(self):  #@
                   pass

                @abc.abstractmethod
                def method1(self):  #@
                   pass

                some_other_decorator = lambda x: x
                @some_other_decorator
                def method2(self):  #@
                   pass
         i    RÆ   i   i   (   R   t   extract_nodeR“   RÉ   Rq   RÂ   (   R   t   methods(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_is_abstract_decoratedX  s
    	c         C   sP   d } t  j | ƒ } t | d j d ƒ ƒ d } |  j | j ƒ  d t ƒ d  S(   Ns?   
            def f():
                g = lambda: None
        t   ft   gi    s   %s.function(   R   Rd   R   t   ilookupR0   RË   R   (   R   R!   Rh   RÒ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_lambda_pytypey  s    c         C   s:   t  j d t ƒ } |  j d t | d j j j ƒ  ƒ d  S(   Ns   lmbd = lambda: Nones   %s.<lambda>t   lmbd(   R   Rd   R)   R0   t   parentR5   RÊ   (   R   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_lambda_qname‚  s    c         C   s˜   d } t  j | ƒ } |  j | d d j ƒ  ƒ |  j | d d j ƒ  ƒ |  j | d d j ƒ  ƒ |  j | d j ƒ  ƒ |  j | d j ƒ  ƒ d  S(   Ns–  
            class A:
                def meth1(self):
                    return 1
                @classmethod
                def meth2(cls):
                    return 2
                @staticmethod
                def meth3():
                    return 3

            def function():
                return 0

            @staticmethod
            def sfunction():
                return -1
        t   At   meth1t   meth2t   meth3R§   t	   sfunction(   R   Rd   R“   t	   is_methodRÂ   (   R   R!   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_is_method†  s    c         C   s]   t  j d k  r d } n d } t j | t ƒ } |  j | d j ƒ  d d d d	 d
 g ƒ d  S(   Ni   i    s'   def f(a, (b, c), *args, **kwargs): passs%   def f(a, b, c, *args, **kwargs): passRÑ   R¯   R°   R±   R›   Rœ   (   i   i    (   R|   R³   R   Rd   R)   R0   t   argnames(   R   R·   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_argnames   s
    	c         C   sv   d } t  j | ƒ } | j d j } | j ƒ  } |  j t | ƒ d ƒ |  j | d t j	 ƒ |  j
 | d j ƒ d S(   s3   test inferred value on a function with empty returnsP   
            def func():
                return

            a = func()
        i   i    N(   R   Rd   R¦   R5   R€   R0   R1   R3   R   R4   R¥   (   R   R!   Rh   t   callt	   func_vals(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_return_nothing¨  s    c         C   s¢   d } t  j | d ƒ } | j d j j j ƒ  d } |  j | t j ƒ |  j	 | j
 d ƒ | j d ƒ d j ƒ  d } |  j | t j ƒ |  j	 | j d ƒ d S(	   s&   test instance attributes for functionssn   
            def test():
                print(test.bar)

            test.bar = 1
            test()
        RR   i   i    Rc   t   bari   N(   R   Rd   R¦   R5   RZ   R€   R3   R   RL   R0   RI   R2   R4   (   R   R!   Rh   RZ   t   one(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_func_instance_attr·  s    c         C   sœ   t  j d ƒ } | j d d } |  j | j d d j d ƒ |  j | j d d j d ƒ |  j | j d d j d ƒ |  j | j d	 d j d ƒ d  S(
   Ns5  
            class classonlymethod(classmethod):
                pass
            class staticonlymethod(staticmethod):
                pass

            class Node:
                @classonlymethod
                def clsmethod_subclass(cls):
                    pass
                @classmethod
                def clsmethod(cls):
                    pass
                @staticonlymethod
                def staticmethod_subclass(cls):
                    pass
                @staticmethod
                def stcmethod(cls):
                    pass
        t   Nodei    t   clsmethod_subclasst   classmethodt	   clsmethodt   staticmethod_subclasst   staticmethodt	   stcmethod(   R   Rd   Rµ   R0   Rº   (   R   Rh   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt'   test_type_builtin_descriptor_subclassesÈ  s    	c         C   sö   t  j d ƒ } | j d d } |  j | j d d j d ƒ |  j | j d d j d ƒ |  j | j d d j d ƒ |  j | j d	 d j d ƒ |  j | j d
 d j d ƒ |  j | j d d j d ƒ |  j | j d d j d ƒ d  S(   Ns¤  
            def static_decorator(platform=None, order=50):
                def wrapper(f):
                    f.cgm_module = True
                    f.cgm_module_order = order
                    f.cgm_module_platform = platform
                    return staticmethod(f)
                return wrapper

            def long_classmethod_decorator(platform=None, order=50):
                def wrapper(f):
                    def wrapper2(f):
                        def wrapper3(f):
                            f.cgm_module = True
                            f.cgm_module_order = order
                            f.cgm_module_platform = platform
                            return classmethod(f)
                        return wrapper3(f)
                    return wrapper2(f)
                return wrapper

            def classmethod_decorator(platform=None):
                def wrapper(f):
                    f.platform = platform
                    return classmethod(f)
                return wrapper

            def classmethod_wrapper(fn):
                def wrapper(cls, *args, **kwargs):
                    result = fn(cls, *args, **kwargs)
                    return result

                return classmethod(wrapper)

            def staticmethod_wrapper(fn):
                def wrapper(*args, **kwargs):
                    return fn(*args, **kwargs)
                return staticmethod(wrapper)

            class SomeClass(object):
                @static_decorator()
                def static(node, cfg):
                    pass
                @classmethod_decorator()
                def classmethod(cls):
                    pass
                @static_decorator
                def not_so_static(node):
                    pass
                @classmethod_decorator
                def not_so_classmethod(node):
                    pass
                @classmethod_wrapper
                def classmethod_wrapped(cls):
                    pass
                @staticmethod_wrapper
                def staticmethod_wrapped():
                    pass
                @long_classmethod_decorator()
                def long_classmethod(cls): 
                    pass
        t	   SomeClassi    t   staticRì   Ré   t   not_so_staticRÌ   t   not_so_classmethodt   classmethod_wrappedt   staticmethod_wrappedt   long_classmethod(   R   Rd   Rµ   R0   Rº   (   R   Rh   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt"   test_decorator_builtin_descriptorsç  s"    =	c         C   sº   t  j d ƒ } t j d ƒ g | j d <| j d ƒ } |  j t | ƒ d ƒ |  j | d t j ƒ |  j | d j	 d ƒ t
 | j d ƒ ƒ } |  j | t j ƒ |  j | j	 d ƒ d  S(   Ns.   
        def test():
            pass
        i*   R5   i   i    (   R   RÎ   R   R4   t   instance_attrsR2   R0   R1   R3   R5   RJ   RK   (   R   RZ   R5   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_igetattr6  s    	t   minverc         C   sE   t  j d ƒ } | j ƒ  } |  j | t j ƒ |  j | j d ƒ d  S(   Ns[   
        def test() -> bytes:
            pass
            pass
            return
        i   (   R   RÎ   t
   last_childR3   R   t   ReturnR0   t   tolineno(   R   RZ   Rú   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt&   test_return_annotation_is_not_the_lastD  s
    	s   3.6c         C   s_   t  j d ƒ } | d } |  j g  | j j D] } | j ^ q, d g ƒ |  j | j d ƒ d  S(   Ns]   
        class MyClass:
            def __init_subclass__(cls):
                pass
        t   __init_subclass__t   clsRé   (   R   RÎ   R0   R›   RI   Rº   (   R   t   klassRÌ   t   n(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_method_init_subclassP  s
    	
/c         C   sK   t  j d ƒ } t | j ƒ  ƒ } |  j | t j ƒ |  j | j d ƒ d  S(   NsY   
        class MyClass:
            def test(self):
                __class__ #@
        t   MyClass(	   R   RÎ   RJ   t   inferR3   R   RH   R0   RI   (   R   R   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt!   test_dunder_class_local_to_method[  s
    	c         C   s9   t  j d ƒ } |  j t ƒ  t | j ƒ  ƒ Wd  QXd  S(   Ns:   
        def test(self):
            __class__ #@
        (   R   RÎ   R;   R   RJ   R  (   R   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt#   test_dunder_class_local_to_functionf  s    	c         C   sK   t  j d ƒ } t | j ƒ  ƒ } |  j | t j ƒ |  j | j d ƒ d  S(   Nsq   
        class MyClass:
            @classmethod
            def test(cls):
                __class__ #@
        R  (	   R   RÎ   RJ   R  R3   R   RH   R0   RI   (   R   R   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt&   test_dunder_class_local_to_classmethodo  s
    	(   R)   R*   R=   R?   R    R­   R¹   R»   R¼   R   t   require_versionR¾   RÃ   RÍ   RÐ   RÔ   R×   RÞ   Rà   Rã   Ræ   Rî   Rö   Rø   Rý   R  R  R  R  (    (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR–   ù   s2   			
								!									O		t   ClassNodeTestc           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 e j e j d d k d ƒ d „  ƒ Z e j e j d d k  d ƒ d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e j d d ƒ d „  ƒ Z d „  Z e j d d ƒ d „  ƒ Z  d „  Z! e j d d ƒ d  „  ƒ Z" e j d d ƒ d! „  ƒ Z# e j d d ƒ d" „  ƒ Z$ e j d d ƒ d# „  ƒ Z% d$ „  Z& d% „  Z' d& „  Z( d' „  Z) d( „  Z* d) „  Z+ d* „  Z, d+ „  Z- e j d d ƒ d, „  ƒ Z. e j d d ƒ d- „  ƒ Z/ d. „  Z0 d/ „  Z1 d0 „  Z2 d1 „  Z3 d2 „  Z4 e j d d ƒ d3 „  ƒ Z5 e j d d ƒ d4 „  ƒ Z6 e j d d ƒ d5 „  ƒ Z7 d6 „  Z8 d7 „  Z9 d8 „  Z: d9 „  Z; d: „  Z< d; „  Z= d< „  Z> d= „  Z? d> „  Z@ d? „  ZA e j d d ƒ d@ „  ƒ ZB dA „  ZC dB „  ZD dC „  ZE dD „  ZF dE „  ZG dF „  ZH dG „  ZI dH „  ZJ dI „  ZK dJ „  ZL e j dK d ƒ dL „  ƒ ZM RS(M   c         C   s   t  |  |  j d d ƒ d  S(   Nt   YOUPIRÌ   (   R   R%   (   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR?   ~  s    c         C   s¦  |  j  d } |  j t | j d ƒ ƒ d ƒ |  j t | j d ƒ ƒ d ƒ |  j | j d ƒ d t j ƒ |  j | j d ƒ d j d ƒ |  j t | j d ƒ ƒ d ƒ |  j | j d ƒ d t j ƒ |  j | j d ƒ d j d ƒ |  j t | j d ƒ ƒ d ƒ |  j | j d ƒ d t j ƒ |  j | j d ƒ d j d	 ƒ |  j t | j d
 ƒ ƒ d ƒ | j sŠ|  j	 t
 | j d ƒ n  xt j j t j d ƒ j f D]õ } |  j t | j d ƒ ƒ d ƒ |  j t | j d ƒ ƒ d ƒ |  j t | j d ƒ ƒ d | | j d ƒ f ƒ |  j | j d ƒ d j | j ƒ |  j t | j d ƒ ƒ d ƒ |  j t | j d
 ƒ ƒ d ƒ |  j t | j d ƒ ƒ d ƒ q©Wd  S(   NR>   t	   __bases__i   R)   i    R,   t   heheR*   s   data.moduleR.   t   __mro__(   R%   R0   R1   R2   R3   R   R4   R5   t   newstyleR;   R   R<   t   _proxiedRj   (   R   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_cls_special_attributes_1  s,          	%1#c         C   sR   t  j d ƒ } | j d ƒ d } |  j | t j ƒ |  j | j | j ƒ  ƒ d  S(   Nsi   
        class A(object): pass
        class B(object): pass
        class C(A, B): pass        
        R  i    (	   R   RÎ   R2   R3   R   t   TupleR0   t   eltst   mro(   R   R   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test__mro__attribute™  s
    	c         C   s†   t  j d ƒ } | j d ƒ d } |  j | t j ƒ |  j t | j ƒ d ƒ |  j | j d t j	 ƒ |  j | j d j
 d ƒ d  S(   Nsz   
        class A(object): pass
        class B(object): pass
        class C(A, B): pass
        class D(C): pass
        R  i    i   t   C(   R   RÎ   R2   R3   R   R  R0   R1   R  RH   RI   (   R   R   t   bases(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test__bases__attribute£  s    	c         C   s   t  j d t ƒ } |  j t | d j d ƒ ƒ d ƒ |  j | d j d ƒ d t j ƒ |  j | d j d ƒ d t j	 ƒ d  S(   Nsn   
            class A(object): pass
            class B(object): pass

            A.__bases__ += (B,)
        RØ   R  i   i   i    (
   R   Rd   R)   R0   R1   R2   R3   R   R  t
   AssignAttr(   R   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_cls_special_attributes_2°  s
    #$c         C   sº   x³ t  |  j d ƒ t j ƒ  t j d ƒ f D]† } |  j t | j d ƒ |  j t | j d ƒ |  j t | j d ƒ |  j t	 | j d ƒ ƒ d ƒ |  j t	 | j d ƒ ƒ d ƒ q, Wd  S(   NR>   i   R  R  R)   R.   R,   (
   R   R%   R   R<   R4   R;   R   R2   R0   R1   (   R   t   inst(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt    test_instance_special_attributes»  s    2c         C   s”   |  j  d } |  j | j ƒ  | ƒ | j ƒ  } |  j t | t j ƒ | ƒ |  j | j d ƒ | j	 ƒ  } |  j
 | t j ƒ |  j | j d ƒ d  S(   NR>   R˜   R
  (   R%   R0   R¡   R¢   R“   t
   isinstanceR   RL   RI   R¤   R3   RH   (   R   R   R¨   Rª   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR­   Ã  s    c         C   sd  t  j d ƒ } | d } | j d ƒ } t | ƒ } |  j | t j ƒ |  j | j d ƒ t	 j
 d d k r‰ |  j t t t | ƒ ƒ nK t | ƒ } |  j | t j ƒ |  j | j d ƒ |  j t t t | ƒ ƒ | j d ƒ } |  j t t t | ƒ ƒ | d	 } | j d ƒ } t | ƒ } |  j | t j ƒ |  j | j d ƒ |  j t t t | ƒ ƒ d  S(
   NsÅ   
        class A():
            def __init__(self): pass
        class B(A): pass
        class C(B): pass
        class D(object): pass
        class F(): pass
        class E(F, D): pass
        R  t   __init__RØ   i    i   t   objectRÌ   t   E(   R   Rd   t   local_attr_ancestorsRJ   R3   R   RH   R0   RI   R|   R³   R;   t   StopIterationR    (   R   R%   t   klass2t   itt	   anc_klass(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_local_attr_ancestorsÍ  s*    	

c         C   sã   t  j d ƒ } | d } | j d ƒ d } |  j | t j ƒ |  j | j j d ƒ | d } | j d ƒ d } |  j | t j ƒ |  j | j j d ƒ t	 | j
 d ƒ ƒ } |  j g  | D] } | j ^ q½ d d d g ƒ d  S(	   NsÀ   
        class A(object):
            def __init__(self): pass
        class B(A):
            def __init__(self, arg, arg2): pass
        class C(A): pass
        class D(C, B): pass
        t   DR  i    t   BR  RØ   R  (   R   Rd   t
   local_attrR3   R   RL   R0   RÖ   RI   R   R   (   R   R%   t   dclasst   initt   cclasst	   ancestorsR   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_local_attr_mroð  s    	

c         C   s    |  j  d } | j d ƒ } t | ƒ } |  j | t j ƒ |  j | j d ƒ |  j t	 t
 t | ƒ ƒ |  j  d } | j d ƒ } |  j t	 t
 t | ƒ ƒ d  S(   NR
  RO   R>   t   member(   R%   t   instance_attr_ancestorsRJ   R3   R   RH   R0   RI   R;   R!  R    (   R   R"  R#  R$  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_instance_attr_ancestors  s    c         C   s,  d d d d h } |  j  d } d „  | j ƒ  Dƒ } |  j | j | ƒ ƒ d „  | j ƒ  Dƒ } |  j | | ƒ |  j d } d	 „  | j ƒ  Dƒ } |  j t g  ƒ | ƒ | j d ƒ } |  j	 t
 | ƒ d
 ƒ |  j	 | d j d ƒ |  j t | j d ƒ d „  | j ƒ  Dƒ } |  j | j | ƒ ƒ d  S(   NR  t   class_methodRÌ   t   static_methodR
  c         S   s   h  |  ] } | j  ’ q S(    (   RI   (   t   .0R^   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pys	   <setcomp>  s   	 c         S   s   h  |  ] } | j  ’ q S(    (   RI   (   R3  R^   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pys	   <setcomp>  s   	 t   Specializationc         S   s   h  |  ] } | j  ’ q S(    (   RI   (   R3  R^   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pys	   <setcomp>  s   	 i   i    t   nonexistentc         S   s   h  |  ] } | j  ’ q S(    (   RI   (   R3  R^   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pys	   <setcomp>   s   	 (   R%   RÏ   R“   t
   issupersett	   mymethodst   assertSetEqualR&   t   setR(  R0   R1   RI   R;   R   (   R   t   expected_methodsR"  RÏ   t   method_locals(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_methods  s     i    i   s"   Python 2 class semantics required.c         C   s   |  j  d } |  j d g g  | j ƒ  D] } | j ^ q& ƒ |  j d } |  j d d g g  | j ƒ  D] } | j ^ qe ƒ d  S(   NR
  R>   R4  (   R%   R0   R,  RI   R&   (   R   R   R¯   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_ancestors+  s    /s"   Python 3 class semantics required.c         C   s…   |  j  d } |  j d d g g  | j ƒ  D] } | j ^ q) ƒ |  j d } |  j d d d g g  | j ƒ  D] } | j ^ qk ƒ d  S(   NR
  R>   R  R4  (   R%   R0   R,  RI   R&   (   R   R   R¯   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_ancestors_py32  s    2c         C   s¤   |  j  d } |  j | j d ƒ |  j d } |  j | j d ƒ |  j d } |  j | j d ƒ |  j d } |  j | j d ƒ |  j d } |  j | j d ƒ d  S(	   NR
  t   classt	   Metaclasst	   metaclasst   MyExceptionRw   t   MyErrort   NotMetaclass(   R%   R0   Rº   R&   (   R   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt	   test_type9  s    c         C   sJ   |  j  d d } |  j g  | j ƒ  D] } | j ^ q$ d d d g ƒ d  S(   Nt   Ccct   Eeet   DddRW   R  (   R'   R0   R,  RI   (   R   t   eeeR  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_inner_classesH  s    c         C   sQ   d } t  j | t ƒ } | d } |  j t | j j ƒ  ƒ d d d d g ƒ d  S(   NsK  
            class WebAppObject(object):
                def registered(cls, application):
                    cls.appli = application
                    cls.schema = application.schema
                    cls.config = application.config
                    return cls
                registered = classmethod(registered)
        t   WebAppObjectRg   t   configt
   registeredt   schema(   R   Rd   R)   R0   R]   Rµ   R   (   R   R!   Rh   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_classmethod_attributesM  s
    	
c         C   sE   d } t  j | t ƒ } | d } |  j t | j d ƒ ƒ d ƒ d  S(   Ns   
            class WebAppObject(object):
                appli = application
                appli += 2
                del self.appli
        RK  Rg   i   (   R   Rd   R)   R0   R1   R2   (   R   R!   Rh   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_class_getattr\  s    
c         C   sH   d } t  j | ƒ } t | d ƒ } |  j t | j d ƒ ƒ d ƒ d  S(   Ns×   
            class WebAppObject(object):
                def __init__(self, application):
                    self.appli = application
                    self.appli += 2
                    del self.appli
         RK  Rg   i   (   R   Rd   R   R0   R1   R2   (   R   R!   Rh   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_instance_getattri  s    c         C   sª   d } t  j | ƒ } t | d ƒ } |  j t | j d ƒ ƒ d | j d ƒ ƒ |  j t | j d ƒ ƒ d | j d ƒ ƒ |  j t | j d ƒ ƒ d | j d ƒ ƒ d  S(	   Ns¨  
            class Parent:
                aa = 1
                cc = 1

            class Klass(Parent):
                aa = 0
                bb = 0

                def incr(self, val):
                    self.cc = self.aa
                    if val > self.aa:
                        val = self.aa
                    if val < self.bb:
                        val = self.bb
                    self.aa += val
        t   Klasst   aai   t   bbi   t   cci   (   R   Rd   R   R0   R1   R2   (   R   R!   Rh   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt%   test_instance_getattr_with_class_attrw  s    ++c         C   s   d } t  j | ƒ } | d } x’ d	 D]Š } t | j | ƒ ƒ } |  j t | ƒ d ƒ |  j | d t ƒ t t | ƒ j | ƒ ƒ } |  j t | ƒ d ƒ |  j | d t	 ƒ q& Wt t | ƒ j d ƒ ƒ } |  j t | ƒ d ƒ |  j | d t
 j ƒ d  S(
   Nsg  
            class Clazz(object):

                def m1(self, value):
                    self.value = value
                m2 = m1

            def func(arg1, arg2):
                "function that will be used as a method"
                return arg1.value + arg2

            Clazz.m3 = func
            inst = Clazz()
            inst.m4 = func
        t   Clazzt   m1t   m2t   m3i   i    t   m4(   RX  RY  RZ  (   R   Rd   R   RK   R0   R1   R3   R   R   R   R   RL   (   R   R!   Rh   Rÿ   RÌ   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_getattr_method_transform  s    
c         C   sx   d } t  j | ƒ } | d } | j d ƒ } |  j t | ƒ d ƒ | d } |  j | t j ƒ |  j | j d ƒ d  S(   Ns¬   
            class Future:
                attr = 1

            class Present(Future):
                pass

            class Past(Present):
                pass
        t   Pastt   attri   i    (	   R   Rd   R2   R0   R1   R3   R   t
   AssignNameRI   (   R   R!   Rh   t   pastR^  t   attr1(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_getattr_from_grandpa®  s    


c         C   su   d } t  j | ƒ } |  j | d j d ƒ |  j | d j d ƒ |  j | d j d ƒ |  j | d j d ƒ d  S(   Nsµ   
            @f(a=2,
               b=3)
            def g1(x):
                print(x)

            @f(a=2,
               b=3)
            def g2():
                pass
        t   g1i   i   t   g2i	   i
   (   R   Rd   R0   t
   fromlinenoRü   (   R   R!   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt#   test_function_with_decorator_linenoÁ  s    t   maxvers   3.0c         C   sO   t  j d ƒ } | d } | j ƒ  } |  j | t j ƒ |  j | j d ƒ d  S(   NsN   
            class Test(object):
                __metaclass__ = type
        t   TestRº   (   R   Rd   RA  R3   R   RH   R0   RI   (   R   Rh   R   RA  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_simple_metaclassÓ  s    	
c         C   s0   t  j d ƒ } | d } |  j | j ƒ  ƒ d  S(   NsM   
            class Test(object):
                __metaclass__ = typ
        Rh  (   R   Rd   RÂ   RA  (   R   Rh   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_errorÞ  s    	
c         C   sO   t  j d ƒ } | d } | j ƒ  } |  j | t j ƒ |  j | j d ƒ d  S(   Nsu   
            from abc import ABCMeta
            class Test(object):
                __metaclass__ = ABCMeta
        Rh  t   ABCMeta(   R   Rd   RA  R3   R   RH   R0   RI   (   R   Rh   R   RA  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_importedæ  s    	
c         C   s0   t  j d ƒ } | d } |  j | j ƒ  ƒ d  S(   Ns    
            # notice `ab` instead of `abc`
            from ab import ABCMeta

            class Meta(object):
                __metaclass__ = ABCMeta
        t   Meta(   R   Rd   R¥   RA  (   R   Rh   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_yes_leakó  s    	
c         C   sˆ   t  j d ƒ } | d } |  j | j ƒ |  j | j ƒ  j d ƒ t  j d ƒ } | d } |  j | j ƒ |  j | j ƒ  j d ƒ d  S(   Nsm   
            from abc import ABCMeta
            class Test:
                __metaclass__ = ABCMeta
        Rh  Rk  s~   
            from abc import ABCMeta
            __metaclass__ = ABCMeta
            class Test:
                pass
        (   R   Rd   R“   R  R0   RA  RI   (   R   Rh   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt    test_newstyle_and_metaclass_goodþ  s    	
	
c         C   s·   t  j d ƒ } | d } | j d d } | d } | j d d } |  j | j ƒ  j d ƒ |  j | j ƒ |  j | j ƒ  ƒ |  j | j ƒ  j d ƒ |  j | j ƒ  j d ƒ d  S(	   Ns  
            from abc import ABCMeta
            class A(object):
                __metaclass__ = ABCMeta
                class B: pass

            __metaclass__ = ABCMeta
            class C:
               __metaclass__ = type
               class D: pass
        RØ   R'  i    R  R&  Rk  Rº   (	   R   Rd   Rµ   R0   RA  RI   RÂ   R  R¥   (   R   Rh   R¯   R°   R±   R²   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_nested_metaclass  s    
	

c         C   s_   t  j d ƒ } | d } |  j | j ƒ | j ƒ  } |  j | t j ƒ |  j | j	 d ƒ d  S(   Ns“   
            from abc import ABCMeta
            class Test:
                __metaclass__ = ABCMeta
            class SubTest(Test): pass
        t   SubTestRk  (
   R   Rd   R“   R  RA  R3   R   RH   R0   RI   (   R   Rh   R   RA  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_parent_metaclass)  s    	
c         C   s‘   t  j d ƒ } i d d 6d d 6} xg | j ƒ  D]Y \ } } xJ | D]B } | | } | j ƒ  } |  j | t j ƒ |  j | j | ƒ qC Wq0 Wd  S(	   Ns¡  
            from abc import ABCMeta

            class FirstMeta(object):
                __metaclass__ = ABCMeta

            class SecondMeta(object):
                __metaclass__ = type

            class Simple(object):
                pass

            class FirstImpl(FirstMeta): pass
            class SecondImpl(FirstImpl): pass
            class ThirdImpl(Simple, SecondMeta):
                pass
        t	   FirstImplt
   SecondImplRk  t	   ThirdImplRº   (   Rs  Rt  (   Ru  (	   R   Rd   R   RA  R3   R   RH   R0   RI   (   R   Rh   t   classesRA  t   namesRI   t   implt   meta(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_ancestors7  s    	

c         C   sE   t  j d ƒ } |  j d d g g  | j ƒ  D] } | j ^ q+ ƒ d  S(   NsÁ   
            def with_metaclass(meta, base=object):
                return meta("NewBase", (base, ), {})

            class ClassWithMeta(with_metaclass(type)): #@
                pass
        t   NewBaseR  (   R   RÎ   R0   R,  RI   (   R   R   Rš   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_typeU  s
    		c         C   sk   t  j d ƒ } |  j t j | ƒ ƒ g  | j ƒ  D] } | j ^ q2 } |  j d | ƒ |  j d | ƒ d  S(   NsD  
            class SSS(object):

                class JJJ(object):
                    pass

                @classmethod
                def Init(cls):
                    cls.JJJ = type('JJJ', (cls.JJJ,), {})

            class AAA(SSS):
                pass

            class BBB(AAA.JJJ):
                pass
        R  t   JJJ(   R   RÎ   RÂ   R   t   _is_metaclassR,  RI   R   (   R   R   Rš   R,  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_no_infinite_metaclass_loopa  s    	"c         C   s:   t  j d ƒ } x$ | D] } |  j d  | j ƒ  ƒ q Wd  S(   Ns#  
            import datetime

            class A(datetime.date): #@
                @classmethod
                def now(cls):
                    return cls()

            class B(datetime.date): #@
                pass

            datetime.date = A
            datetime.date = B
        (   R   RÎ   R0   t   NoneRA  (   R   t	   ast_nodesR   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt-   test_no_infinite_metaclass_loop_with_redefinew  s    	c         C   s[   t  j d ƒ } |  j d g g  | j ƒ  D] } | j ^ q( ƒ |  j d | j ƒ  j ƒ d  S(   Nsw   
            import six

            class WithMeta(six.with_metaclass(type, object)): #@
                pass
        R  Rº   (   R   RÎ   R0   R,  RI   RA  (   R   R   Rš   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_generator_hack‰  s    	#c         C   sZ   t  j d ƒ } t | j ƒ  ƒ } | j ƒ  } |  j | t j ƒ |  j | j	 ƒ  d ƒ d  S(   Ns‰   
        import six
        import abc

        @six.add_metaclass(abc.ABCMeta)
        class WithMeta(object):
            pass
        s   abc.ABCMeta(
   R   RÎ   RJ   R  RA  R3   R   RH   R0   RÊ   (   R   R   R€   RA  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_using_six_add_metaclass–  s    	c         C   s8   t  j d ƒ } t | j ƒ  ƒ } |  j | j ƒ  ƒ d  S(   Nsi   
        import six
        @six.add_metaclass()
        class Invalid(object):
            pass
        (   R   RÎ   RJ   R  R¥   RA  (   R   R   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt)   test_using_invalid_six_add_metaclass_call¤  s    	c         C   s?   t  j d ƒ } | d } |  j t | j ƒ  ƒ t j g ƒ d  S(   NsF  
            class Delegate(object):
                def __get__(self, obj, cls):
                    return getattr(obj._subject, self.attribute)

            class CompositeBuilder(object):
                __call__ = Delegate()

            builder = CompositeBuilder(result, composite)
            tgts = builder()
        t   tgts(   R   Rd   R0   R   R  R   t   Uninferable(   R   Rh   t   instance(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_nonregr_infer_callresult®  s    
	
c         C   sÊ   t  j d ƒ } d d f d d f d d d f d d d
 d f d d f d d d f g
 } xl | D]d \ } } | | j ƒ  } | d  k r– |  j | ƒ q^ |  j t | ƒ g  | D] } | j ^ q¬ ƒ q^ Wd  S(   NsS  
            from collections import deque
            from textwrap import dedent

            class First(object): #@
                __slots__ = ("a", "b", 1)
            class Second(object): #@
                __slots__ = "a"
            class Third(object): #@
                __slots__ = deque(["a", "b", "c"])
            class Fourth(object): #@
                __slots__ = {"a": "a", "b": "b"}
            class Fifth(object): #@
                __slots__ = list
            class Sixth(object): #@
                __slots__ = ""
            class Seventh(object): #@
                __slots__ = dedent.__name__
            class Eight(object): #@
                __slots__ = ("parens")
            class Ninth(object): #@
                pass
            class Ten(object): #@
                __slots__ = dict({"a": "b", "c": "d"})
        t   FirstR¯   R°   t   Secondt   Thirdt   Fourtht   Fiftht   Sixtht   Seventht   dedentt   Eightt   parenst   Nintht   TenR±   (   R¯   R°   (   R¯   (   RŒ  N(   R¯   R°   (   RŽ  N(   R  N(   R‘  (   R“  (   R”  N(   R¯   R±   (   R   Rd   R€  t   slotsR¥   R0   R   R5   (   R   Rh   Ry   Rÿ   t   expected_valueR–  R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt
   test_slots¿  s$    						c         C   s~   t  j d ƒ } | d j ƒ  } |  j t | ƒ d ƒ |  j | d j d ƒ |  j | d j d ƒ |  j | d j d	 ƒ d  S(
   NsW   
        class UnicodeSlots(object):
            __slots__ = (u"a", u"b", "c")
        t   UnicodeSlotsi   i    R¯   i   R°   i   R±   (   R   Rd   R–  R0   R1   R5   (   R   R%   R–  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_slots_py2í  s    	c         C   sX   t  j d ƒ } d } |  j t ƒ  } | d j ƒ  Wd  QX|  j t | j ƒ | ƒ d  S(   NsD   
        class OldStyle:
            __slots__ = ("a", "b")
        s8   The concept of slots is undefined for old-style classes.t   OldStyle(   R   Rd   R;   t   NotImplementedErrorR–  R0   Rv   Rw   (   R   R%   t   msgRx   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_slots_py2_not_implementedù  s    	c         C   sm   t  j d ƒ } | d } | j ƒ  } |  j t | ƒ d ƒ |  j | d j d ƒ |  j | d j d ƒ d  S(   Ns|   
        class Issue(object):
          SlotDefaults = {'id': 0, 'id1':1}
          __slots__ = SlotDefaults.keys()
        t   Issuei   i    t   idi   t   id1(   R   Rd   R–  R0   R1   R5   (   R   R%   Rÿ   R–  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_slots_for_dict_keys  s    	
c         C   s3   t  j d ƒ } | d } |  j | j ƒ  g  ƒ d  S(   NsA   
        class Klass(object):
            __slots__ = ()
        RR  (   R   Rd   R0   R–  (   R   R%   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_slots_empty_list_of_slots  s    	
c         C   s^   t  j d ƒ } | d } | j ƒ  } |  j t t d „  | Dƒ ƒ ƒ d d d d d g ƒ d  S(	   Nsã   
        class FirstParent(object):
            __slots__ = ('a', 'b', 'c')
        class SecondParent(FirstParent):
            __slots__ = ('d', 'e')
        class Third(SecondParent):
            __slots__ = ('d', )
        RŒ  c         s   s   |  ] } | j  Vq d  S(   N(   R5   (   R3  t   slot(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pys	   <genexpr>#  s    R¯   R°   R±   R²   t   e(   R   Rd   R–  R0   R]   R9  (   R   R%   Rÿ   R–  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_slots_taken_from_parents  s    	
c         C   sM   t  j d ƒ } | d } |  j | j ƒ  ƒ | d } |  j | j ƒ  ƒ d  S(   Ns   
        class A(object):
            __slots__ = ('a', )
        class B(A): pass
        class C(B):
            __slots__ = ('a', )
        R  R'  (   R   Rd   R¥   R–  (   R   R%   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_all_ancestors_need_slots&  s    	

c         C   s0   |  j  g  | j ƒ  D] } | j ^ q | ƒ d  S(   N(   R0   R  RI   (   R   R   t   expected_mroR.  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   assertEqualMro3  s    c         C   sN   t  j d ƒ } |  j t ƒ  } | j ƒ  Wd  QX|  j t | j ƒ d ƒ d  S(   Ns   
        class Old: passs+   Could not obtain mro for old-style classes.(   R   RÎ   R;   Rœ  R  R0   Rv   Rw   (   R   R   Rx   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_no_mro_for_old_style8  s
    	c      
   C   s;   t  j d ƒ } |  j | d d d d d d d d	 g ƒ d  S(
   Ns  
        class Factory:
            pass
        class ClientFactory(Factory):
            pass
        class ReconnectingClientFactory(ClientFactory):
            pass
        class WebSocketAdapterFactory(object):
            pass
        class WebSocketClientFactory(WebSocketAdapterFactory, ClientFactory):
            pass
        class WampWebSocketClientFactory(WebSocketClientFactory):
            pass
        class RetryFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
            pas
        t   RetryFactoryt   WampWebSocketClientFactoryt   WebSocketClientFactoryt   WebSocketAdapterFactoryR  t   ReconnectingClientFactoryt   ClientFactoryt   Factory(   R   RÎ   R©  (   R   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt*   test_mro_for_classes_with_old_style_in_mroA  s    		c         C   sE   t  j d ƒ } |  j | d d d d d d g ƒ |  j | j ƒ d  S(   Nsë   
        class Old:
            pass
        class New(object):
            pass
        class New1(object):
            pass
        class New2(New, New1):
            pass
        class NewOld(New2, Old): #@
            pass
        t   NewOldt   New2t   Newt   New1R  t   Old(   R   RÎ   R©  R“   R  (   R   R   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt&   test_combined_newstyle_oldstyle_in_mro[  s    	"c         C   s3   t  j d ƒ } |  j | d d d d d g ƒ d  S(   Ns«   
        import six

        class C(object):
            pass
        class B(C):
            pass
        class A(six.with_metaclass(type, B)):
            pass
        RØ   R'  R  R  (   R   Rd   R©  (   R   Rh   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_with_metaclass_mrol  s    		c         C   s—  t  j d ƒ } |  j | d d d d d g ƒ |  j | d d d d d	 d g ƒ |  j | d
 d
 d d d	 d g ƒ |  j t ƒ  } | d j ƒ  Wd  QX| j d	 ƒ d } | j d ƒ d } | j d ƒ d } t  j j t	 j d ƒ d } |  j
 | j j | | | | g | | | | g g ƒ |  j t ƒ  } | d j ƒ  Wd  QX|  j
 | j j | | | | g | | | | g g ƒ |  j | d d d d d d d g ƒ |  j | d d d d d d g ƒ |  j | d d d d d d d d d d g	 ƒ |  j | d d d d d d d g ƒ |  j t ƒ  } | d j ƒ  Wd  QX| j d ƒ d } |  j
 | j j | ƒ |  j | j t ƒ |  j | j t ƒ d  S(   Ns  
        class C(object): pass
        class D(dict, C): pass

        class A1(object): pass
        class B1(A1): pass
        class C1(A1): pass
        class D1(B1, C1): pass
        class E1(C1, B1): pass
        class F1(D1, E1): pass
        class G1(E1, D1): pass

        class Boat(object): pass
        class DayBoat(Boat): pass
        class WheelBoat(Boat): pass
        class EngineLess(DayBoat): pass
        class SmallMultihull(DayBoat): pass
        class PedalWheelBoat(EngineLess, WheelBoat): pass
        class SmallCatamaran(SmallMultihull): pass
        class Pedalo(PedalWheelBoat, SmallCatamaran): pass

        class OuterA(object):
            class Inner(object):
                pass
        class OuterB(OuterA):
            class Inner(OuterA.Inner):
                pass
        class OuterC(OuterA):
            class Inner(OuterA.Inner):
                pass
        class OuterD(OuterC):
            class Inner(OuterC.Inner, OuterB.Inner):
                pass
        class Duplicates(str, str): pass
        
        R&  t   dictR  R  t   D1t   B1t   C1t   A1t   E1t   F1i    t   G1t   PedalWheelBoatt
   EngineLesst   DayBoatt	   WheelBoatt   Boatt   SmallCatamarant   SmallMultihullt   Pedalot   OuterDt   Innert
   Duplicates(   R   Rd   R©  R;   R
   R  R2   t   MANAGERt   astroid_cacheR   R0   Rw   t   mrosR   Rÿ   R3   R	   R   (   R   Rh   Rx   R¾  R¼  R½  t   object_RÌ  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_mroy  sJ    #	 ##c         C   s>   t  j d ƒ } |  j | d d d d d d d d d	 g	 ƒ d  S(
   Nsh  
        def MixinFactory(cls):
            mixin_name = '{}Mixin'.format(cls.__name__)
            mixin_bases = (object,)
            mixin_attrs = {}
            mixin = type(mixin_name, mixin_bases, mixin_attrs)
            return mixin
        class MixinA(MixinFactory(int)):
            pass
        class MixinB(MixinFactory(str)):
            pass
        class Base(object):
            pass
        class ClassA(MixinA, Base):
            pass
        class ClassB(MixinB, ClassA):
            pass
        class FinalClass(ClassB):
            def __init__(self):
                self.name = 'x'
        t
   FinalClasst   ClassBt   MixinBRl   t   ClassAt   MixinAt   BaseR  (   R   RÎ   R©  (   R   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_mro_with_factoriesÆ  s
    	c         C   sK   t  j d ƒ } t | j | ƒ ƒ } |  j | t ƒ |  j | j | ƒ d  S(   Nsp   
        import contextlib

        @contextlib.contextmanager
        def test(): #@
            yield
        (   R   RÎ   RJ   t   infer_call_resultR3   R   R0   RÖ   (   R   RZ   t   result(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt,   test_generator_from_infer_call_result_parentã  s
    	c         C   sà   t  j d ƒ } t | j ƒ  ƒ } |  j | t j ƒ |  j | j d ƒ |  j | j	 d g ƒ |  j | d t j
 ƒ |  j | d j d ƒ |  j | d t j
 ƒ |  j | d j d ƒ |  j t ƒ  | j d ƒ Wd  QXd  S(	   NsH   
        type('A', (object, ), {"a": 1, "b": 2, missing: 3}) #@
        RØ   R  R¯   i   R°   i   t   missing(   R   RÎ   RJ   R  R3   R   RH   R0   RI   t	   basenamesR4   R5   R;   R   R2   (   R   Rv  R¬   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_type_three_argumentsï  s    	c         C   s@   t  j d ƒ } t j d ƒ d d } |  j | j ƒ  | ƒ d  S(   Ns3   
        class A(object):
            pass
        Rº   i   i    (   R   RÎ   R   t   builtin_lookupR0   t   implicit_metaclass(   R   Rÿ   t   type_cls(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_implicit_metaclassþ  s    	c         C   sZ   t  j d ƒ } | j ƒ  } | j d ƒ } |  j t | ƒ d ƒ |  j t | j d ƒ d  S(   Ns3   
        class A(object):
            pass
        R  i   (   R   RÎ   t   instantiate_classR2   R0   R1   R;   R   (   R   Rÿ   Rˆ  RZ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_implicit_metaclass_lookup  s    	c         C   s2   t  j d ƒ } |  j t | j d ƒ ƒ d ƒ d  S(   Ns3   
        class A(object): pass            
        R  i   (   R   RÎ   R0   R1   R2   (   R   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt&   test_metaclass_lookup_using_same_class  s    	c         C   s?   t  j d ƒ } | d } |  j t j t | j d ƒ ƒ ƒ d  S(   Ns™   
        import six

        class Metaclass(type):
            foo = lala

        @six.add_metaclass(Metaclass)
        class B(object): pass 
        R'  t   foo(   R   Rd   R0   R   R‡  RJ   RK   (   R   R%   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt'   test_metaclass_lookup_inferrence_errors  s    	
c   
      C   s  t  j d ƒ } | d } t | j d ƒ ƒ } |  j | t j ƒ |  j | j d ƒ t | j d ƒ ƒ } |  j | t	 ƒ |  j | j
 | d ƒ t | j d ƒ ƒ } |  j | t	 ƒ |  j | j
 | d ƒ t | d j d ƒ ƒ } |  j | t ƒ t j | ƒ } |  j | | d ƒ t | j d ƒ ƒ } |  j | t j ƒ |  j | j d ƒ t | j d	 ƒ ƒ }	 |  j |	 t j ƒ d  S(
   NsÒ  
        import six
         
        class Metaclass(type):
            foo = 42
            @classmethod
            def class_method(cls):
                pass
            def normal_method(cls):
                pass
            @property
            def meta_property(cls):
                return 42
            @staticmethod
            def static():
                pass

        @six.add_metaclass(Metaclass)
        class A(object):
            pass
        RØ   Ræ  i*   R1  R@  t   normal_methodt   meta_propertyRð   (   R   Rd   RJ   RK   R3   R   R4   R0   R5   R   t   boundR   R   t   get_wrapping_classRL   (
   R   R%   t   aclst   normal_attrR1  Rè  t   property_metat   wrappingt   property_classRð   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_metaclass_lookup$  s*    	
c         C   s&   t  j d ƒ } |  j | j ƒ  ƒ d  S(   Ns   
        class A: pass
        (   R   RÎ   R¥   Rà  (   R   Rÿ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_implicit_metaclass_is_noneW  s    	c         C   s^   t  j d ƒ } | j d ƒ d } t | j ƒ  ƒ } |  j | t j ƒ |  j | j	 d ƒ d  S(   NsÂ   
        # A has an invalid MRO, local_attr should fallback
        # to using .ancestors.
        class A(object, object):
            test = 42
        class B(A): #@
            pass
        Rc   i    i*   (
   R   RÎ   R(  RJ   R  R3   R   R4   R0   R5   (   R   Rÿ   R™   R€   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_local_attr_invalid_mro^  s    	c         C   s–   t  j d ƒ } |  j | d j ƒ  ƒ |  j | d j ƒ  ƒ |  j | d j ƒ  ƒ d d  l } t  j ƒ  } | j | ƒ } |  j | d j ƒ  ƒ d  S(   Ns  
        class Getattr(object):
            def __getattr__(self, attrname):
                pass

        class Getattribute(object):
            def __getattribute__(self, attrname):
                pass

        class ParentGetattr(Getattr):
            pass
        t   Getattrt   Getattributet   ParentGetattriÿÿÿÿt	   timedelta(   R   Rd   R“   t   has_dynamic_getattrt   datetimeRŠ   t   module_buildRÂ   (   R   R%   Rù  t   astroid_builder(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_has_dynamic_getattrl  s    	c         C   sd   t  j d ƒ } d d d d d g } | d j ƒ  } g  | D] } | j ^ q; } |  j | | ƒ d  S(   Ns‡   
        import collections
        _A = collections.namedtuple('A', 'a')

        class A(_A): pass

        class B(A): pass
        R'  RØ   t   tupleR  (   R   Rd   R  RI   R0   (   R   R%   Rw  R  t   it   class_names(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_duplicate_bases_namedtuple„  s    	c         C   sÐ   t  j d ƒ } t | d j ƒ  ƒ } |  j t | j d ƒ ƒ t j ƒ |  j t | j d ƒ ƒ t j ƒ t | d j ƒ  ƒ } t | j d ƒ ƒ } |  j | t ƒ t | j d ƒ ƒ } |  j | t j ƒ d  S(   Ns‹   
        class Test(object): #@
            lam = lambda self: self
            not_method = lambda xargs: xargs
        Test() #@
        i    t   lamt
   not_methodi   (	   R   RÎ   RJ   R  R3   RK   R   t   LambdaR   (   R   R  Rÿ   Rˆ  R  R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt"   test_instance_bound_method_lambdas’  s    	""c         C   s&   t  j d ƒ } |  j | j g  ƒ d  S(   NsQ   
        def ala():
            def bala(): #@
                func = 42
        (   R   RÎ   R0   t   extra_decorators(   R   t   ast_node(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt.   test_class_extra_decorators_frame_is_not_class£  s    	c         C   s&   t  j d ƒ } |  j | j g  ƒ d  S(   Nsq   
        class Ala(object):
             def func(self): #@
                 pass
             func = 42
        (   R   RÎ   R0   R  (   R   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt8   test_class_extra_decorators_only_callfunc_are_considered«  s    	c         C   s&   t  j d ƒ } |  j | j g  ƒ d  S(   Ns¬   
        class Ala(object):
             def func(self): #@
                 pass
             def __init__(self):
                 self.func = staticmethod(func)

        (   R   RÎ   R0   R  (   R   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt@   test_class_extra_decorators_only_assignment_names_are_considered´  s    	c         C   s9   t  j d ƒ } |  j | j g  ƒ |  j | j d ƒ d  S(   Ns€   
        class Ala(object):
             def func(self): #@
                pass
             bala = staticmethod(func)
        RÌ   (   R   RÎ   R0   R  Rº   (   R   R  (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt5   test_class_extra_decorators_only_same_name_considered¿  s    	c         C   sq   t  j d ƒ \ } } |  j t | j ƒ d ƒ |  j | j d ƒ |  j t | j ƒ d ƒ |  j | j d ƒ d  S(   Ns	  
        class Ala(object):
             def static(self): #@
                 pass
             def class_method(self): #@
                 pass
             class_method = classmethod(class_method)
             static = staticmethod(static)              
        i   Ré   Rì   (   R   RÎ   R0   R1   R  Rº   (   R   R2  Rê   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_class_extra_decoratorsÉ  s    c         C   s…   t  j d ƒ } t | j ƒ  ƒ } t | j d ƒ ƒ } |  j | t j ƒ |  j | j	 d ƒ | j
 ƒ  } |  j t | j ƒ d ƒ d  S(   Ns€  
        def _bind(arg):
            return arg.bind

        class A(object):
            @property
            def bind(self):
                return 42
            def irelevant(self):
                # This is important, because it used to trigger
                # a maximum recursion error.
                bind = _bind(self)
                return bind 
        A() #@
        t   bindi*   i    (   R   RÎ   RJ   R  RK   R3   R   R4   R0   R5   t   scopeR1   R  (   R   R   R€   R  RÖ   (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt2   test_extra_decorators_only_class_level_assignmentsØ  s    	Rù   c         C   sn   d } t  j | t ƒ } | d } |  j t | j ƒ d ƒ |  j g  | j D] } | j ^ qK d d g ƒ d  S(   Nsƒ   
            class TestKlass(object, metaclass=TestMetaKlass,
                    foo=42, bar='baz'):
                pass
        t	   TestKlassi   Ræ  Rä   (   R   Rd   R)   R0   R1   t   keywordst   arg(   R   R!   Rh   Rÿ   t   x(    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   test_class_keywordsï  s
    
(N   R)   R*   R?   R  R  R  R  R  R­   R%  R-  R0  R<  t   unittestt   skipIfR|   R³   R=  R>  RE  RJ  RO  RP  RQ  RV  R\  Rb  Rf  R   R  Ri  Rj  Rl  Rn  Ro  Rp  Rr  Rz  R|  R  R‚  Rƒ  R„  R…  R‰  R˜  Rš  Rž  R¢  R£  R¦  R§  R©  Rª  R²  R¸  R¹  RÑ  RØ  RÛ  RÞ  Râ  Rä  Rå  Rç  Rñ  Rò  Ró  Rü  R   R  R  R  R	  R
  R  R  R  (    (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyR	  |  sŒ   			
				
	#			((																	
		.								M					
			3									
		t   __main__((   R,   R6   R|   t	   functoolsR    R  Rh   R   R   R   R   t   astroid.exceptionsR   R   R   R   R	   R
   R   R   R   t   astroid.basesR   R   R   R   R   R   R   t   astroid.testsR   R   t   SysPathSetupR    t   TestCaseR+   R–   R	  R)   t   main(    (    (    sB   lib/python2.7/site-packages/astroid/tests/unittest_scoped_nodes.pyt   <module>   s2   @(			Àÿ „ÿ ÿ ÿ ÿ „