σ
ίΘ[c           @` sΊ   d  d l  m Z m Z m Z m 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 m Z m Z m Z d	   Z d
   Z d   Z d   Z d   Z d   Z d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t
   namedtupleNi   (   t   sixi   (   t   introspection(   t   find_current_modulet   find_mod_objst   isinstancemethodt
   minversionc          C` sj   d }  d } d } t  d  j |  k s- t  t  d  j | k sH t  t  d t  j | k sf t  d S(   u   
    Tests that the `find_current_module` function works. Note that
    this also implicitly tests compat.misc._patched_getmodule
    u   astropy.utils.introspectionu&   astropy.utils.tests.test_introspectioni    i   N(   R   t   __name__t   AssertionErrort   True(   t   mod1t   mod2t   mod3(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   test_pkg_finder   s    c          C` sς   d d l  m }  t } t d  t k s. t  t d  j | k sI t  t |    d  d  k sh t  t d t  j | k s t  t d t g  j | k s§ t  t d d g  j | k sΘ t  t j	 t
   t d d g  Wd  QXd  S(   Ni    (   t   getrecursionlimiti   u   astropy.utils.introspectionu&   faddfdsasewrweriopunjlfiurrhujnkflgwhu(   t   sysR   R   R   R   R   t   NoneR   t   pytestt   raisest   ImportError(   R   t	   thismodnm(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   test_find_current_mod   s    !!c          C` sξ   t  d  \ }  } } d d  l } d |  k s3 t  | j | k sH t  t  t d t \ }  } } d |  k su t  d | k s t  t | k s t  t  t d t \ }  } } d |  k sΖ t  d | k sΨ t  t | k sκ t  d  S(   Nu   astropyi    u   testt
   onlylocalsu
   namedtupleu   collections.namedtuple(   R   t   astropyR   t   testR   t   FalseR   R   (   t   lnmst   fqnst   objsR   (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   test_find_mod_objs.   s    c          C` s’   d t  f d     Y}  t j |   d t f d     Y } t | | j  sT t  t | | j  sm t  t | | j  s t  t | | j	  s t  d S(   u*  
    Note, this is an exact copy of the doctest in `isinstancemethod`'s
    docstring.

    It is included here as well so that it can be tested on Python 2 and 3
    which require very different implementations.  Once we enable running
    doctests on Python 3 this extra test can be dropped.
    t	   MetaClassc           B` s   e  Z d    Z RS(   c         S` s   d  S(   N(    (   t   cls(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   a_classmethodP   s    (   R   t
   __module__R$   (    (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyR"   O   s   t   MyClassc           B` s/   e  Z d    Z e d    Z e d    Z RS(   c         S` s   d  S(   N(    (   t   self(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   an_instancemethodT   s    c         S` s   d  S(   N(    (   R#   (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   another_classmethodV   s    c           S` s   d  S(   N(    (    (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   a_staticmethodY   s    (   R   R%   R(   t   classmethodR)   t   staticmethodR*   (    (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyR&   R   s   	N(
   t   typeR   t   add_metaclasst   objectR	   R$   R   R)   R*   R(   (   R"   R&   (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   test_isinstancemethodE   s    
	c          C` s   d d l  m }  |  t d   } d | _ d d d g } d d	 g } x# | D] } t | |  sM t  qM Wx$ | D] } t | |  ss t  qs Wd  S(
   Ni    (   t
   ModuleTypeu   test_moduleu   0.12.2u   0.12u   0.12.1u
   0.12.0.devu   1u   1.2rc1(   t   typesR1   t   strt   __version__R
   R   (   R1   t   test_modulet   good_versionst   bad_versionst   version(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   _minversion_testb   s    	c          C` sW   d d  l  }  d |  j k rL |  j d } d  |  j d <t   | |  j d <n  t   d  S(   Ni    u   pkg_resourcesu   pkg_resource(   R   t   modulesR   R9   (   R   t   pkg_resources_saved(    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   test_minversionn   s    (   t
   __future__R    R   R   R   t   collectionsR   R   t   externR   t    R   R   R   R	   R
   R   R   R!   R0   R9   R<   (    (    (    sE   lib/python2.7/site-packages/astropy/utils/tests/test_introspection.pyt   <module>   s   ""					