Ñò
‘à"Ic           @   s‡   d  Z  d d k Z d d k Z d d k Z d d k l Z d Z d „  Z d e i f d „  ƒ  YZ	 d „  Z
 e d	 j o e
 ƒ  n d S(
   s&   
Test the API of the symtable module.
iÿÿÿÿN(   t   test_supportsM  
import sys

glob = 42

class Mine:
    instance_var = 24
    def a_method(p1, p2):
        pass

def spam(a, b, *var, **kw):
    global bar
    bar = 47
    x = 23
    glob
    def internal():
        return x
    return internal

def foo():
    exec 'm'
    from sys import *

def namespace_test(): pass
def namespace_test(): pass
c         C   s3   x, |  i  ƒ  D] } | i ƒ  | j o | Sq Wd  S(   N(   t   get_childrent   get_name(   t   blockt   namet   ch(    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt
   find_block'   s     t   SymtableTestc           B   sS  e  Z e i ƒ  i i ƒ  z) e i d  e ƒ e i e	 d d ƒ Z
 Wd QXe e
 d ƒ Z e e d ƒ Z e e
 d ƒ Z e e d ƒ Z e e
 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 d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% RS(   t   ignoret   ?t   execNt   Minet   a_methodt   spamt   internalt   fooc            sÒ   ‡  f d †  } ˆ  i  i d ƒ } t i ƒ  i i ƒ  } z‘ | ~ } t i d t ƒ ˆ  i	 | i
 ƒ  ƒ | | d ƒ | i ƒ  ˆ  i	 | i ƒ  ƒ | | d ƒ | i ƒ  ˆ  i	 | i ƒ  ƒ | | d ƒ Wd  QXd  S(   Nc            s   ˆ  i  t |  i ƒ | ƒ d  S(   N(   t   assertEqualt   strt   message(   t   wt   msg(   t   self(    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   check<   s    t   globt   alwayss+   is_vararg() is obsolete and will be removeds/   is_keywordarg() is obsolete and will be removeds-   is_in_tuple() is obsolete and will be removed(   t   topt   lookupR    t   check_warningst   __exit__t	   __enter__t   warningst   simplefiltert   DeprecationWarningt   assertFalset	   is_varargt   resett   is_keywordargt   is_in_tuple(   R   R   t   symt   _[1]R   (    (   R   s/   /mit/python/lib/python2.6/test/test_symtable.pyt
   test_noops:   s    #

c         C   s   |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ d  S(   Nt   modulet   classt   function(   R   R   t   get_typeR   R   R   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt	   test_typeJ   s
    c         C   sž   |  i  |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i |  i i ƒ  ƒ |  i |  i i ƒ  ƒ d  S(   N(   R!   R   t   is_optimizedt   has_exect   has_import_start
   assertTrueR   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_optimizedQ   s    c         C   s\   |  i  |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i |  i i ƒ  ƒ d  S(   N(   R!   R   t	   is_nestedR   R   R1   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_nested\   s    c         C   sF   |  i  |  i i ƒ  ƒ |  i  |  i i ƒ  ƒ |  i |  i i ƒ  ƒ d  S(   N(   R1   R   t   has_childrenR   R!   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_childrenb   s    c         C   s6   |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ d  S(   Ni    i   (   R   R   t
   get_linenoR   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_linenog   s    c      	   C   sh   |  i  } |  i | i ƒ  d	 ƒ |  i | i ƒ  d
 ƒ |  i | i ƒ  d ƒ |  i |  i i ƒ  d ƒ d  S(   Nt   at   bt   kwt   vart   barR   t   xR   (   R9   R:   R;   s   var(   R9   R:   R=   s   internalR;   s   varR>   (   R=   s   glob(   R>   (   R   R   t   get_parameterst
   get_localst   get_globalsR   t	   get_frees(   R   t   func(    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_function_infok   s    	c         C   s€   |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ d  S(   NR   R=   R>   t   instance_var(   R1   R   R   t	   is_globalR!   R   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_globalss   s    c         C   sB   |  i  |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ d  S(   NR>   (   R1   R   R   t   is_localR!   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt
   test_localy   s    c         C   sa   |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ d  S(   NR>   R   (   R1   R   R   t   is_referencedR   R!   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_referenced}   s    c         C   sS   x- d D]% } |  i  |  i i | ƒ i ƒ  ƒ q W|  i |  i i d ƒ i ƒ  ƒ d  S(   NR9   R<   R;   R>   (   R9   s   vars   kw(   R1   R   R   t   is_parameterR!   (   R   R&   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_parameters‚   s     #c         C   sK   |  i  t |  i i ƒ  ƒ t |  i i ƒ  ƒ ƒ |  i t |  i i d ƒ d  S(   Nt   not_here(   R   t   lenR   t   get_identifierst   get_symbolst   assertRaisest   KeyErrorR   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_symbol_lookup‡   s    c         C   s'  |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  |  i j ƒ |  i i d ƒ } |  i	 t
 | i ƒ  ƒ d ƒ |  i t | i ƒ d  S(   NR   R   R   R   t   namespace_testR>   i   (   R1   R   R   t   is_namespaceR   R   R!   t   assert_t   get_namespaceR   RO   t   get_namespacesRR   t
   ValueError(   R   t   ns_test(    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_namespaces   s    (c         C   sŸ   |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i  |  i i d ƒ i ƒ  ƒ |  i |  i i d ƒ i ƒ  ƒ d  S(   NR>   R=   R   R   (   R1   R   R   t   is_assignedR   R   R!   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_assignedš   s
    c         C   s#   |  i  |  i i d ƒ i ƒ  ƒ d  S(   Nt   sys(   R1   R   R   t   is_imported(   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_imported¡   s    c         C   sq   |  i  |  i i ƒ  d ƒ |  i  |  i i ƒ  d ƒ |  i  |  i i d ƒ i ƒ  d ƒ |  i  |  i i ƒ  d ƒ d  S(   NR   R   R>   R   (   R   R   R   R   R   R   (   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt	   test_name¤   s    "c         C   s   |  i  |  i i ƒ  d ƒ d  S(   NR   (   s   a_method(   R   R   t   get_methods(   R   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_class_infoª   s    c            s'   ‡  f d †  } | d ƒ | d ƒ d  S(   Nc            sZ   y t  i  |  d d ƒ Wn( t j
 o } ˆ  i | i d ƒ n Xˆ  i d |  f ƒ d  S(   NR   R
   s   no SyntaxError for %r(   t   symtablet   SyntaxErrorR   t   filenamet   fail(   t
   brokencodet   e(   R   (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   checkfilename°   s
    s   def f(x): foo)(s   def f(x): global x(    (   R   Rk   (    (   R   s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_filename_correct­   s    
c         C   s   t  i  d d d ƒ } d  S(   Nt   42R	   t   eval(   Re   (   R   t   symbols(    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt	   test_evalº   s    c         C   s   t  i  d d d ƒ } d  S(   NRm   R	   t   single(   Re   (   R   Ro   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   test_single½   s    c         C   s   t  i  d d d ƒ } d  S(   Ns   def f(x): return xR	   R
   (   Re   (   R   Ro   (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt	   test_execÀ   s    (&   t   __name__t
   __module__R   t   catch_warningsR   R   R   t   SyntaxWarningRe   t	   TEST_CODER   R   R   R   R   R   R   R(   R-   R2   R4   R6   R8   RD   RG   RI   RK   RM   RT   R\   R^   Ra   Rb   Rd   Rl   Rp   Rr   Rs   (    (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyR   -   s:   																				c           C   s   t  i t ƒ d  S(   N(   R    t   run_unittestR   (    (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt	   test_mainÄ   s    t   __main__(   t   __doc__Re   t   unittestR   t   testR    Rx   R   t   TestCaseR   Rz   Rt   (    (    (    s/   /mit/python/lib/python2.6/test/test_symtable.pyt   <module>   s   	—	