ó
‹wÛjc           @   së   d  d l  m Z d  d l Z d  d l Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d e j f d „  ƒ  YZ d „  Z e d k rç e ƒ  n  d S(   iÿÿÿÿ(   t   test_supportNt   FuncAttrsTestc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s>   d d d „  ƒ  Y} d „  } | |  _  | ƒ  |  _ | |  _ d  S(   Nt   Fc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   t   self(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   a   s    (   t   __name__t
   __module__R   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR      s   c           S   s   d S(   Ni   (    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   b
   s    (    (   t   ft   fiR   (   R   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   setUp   s
    		c         C   sy   y t  | | | ƒ Wn | k
 r' n X|  j d | | f ƒ y t | | ƒ Wn | k
 rc n X|  j d | ƒ d  S(   Ns!   shouldn't be able to set %s to %rs   shouldn't be able to del %s(   t   setattrt   failt   delattr(   R   t   objt   namet   valuet
   exceptions(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   cannot_set_attr   s    (   R   R   R
   R   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR      s   	
t   FunctionPropertiesTestc           B   sk   e  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  |  j j t ƒ d  S(   N(   t   assertEqualR   R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_module"   s    c         C   s|   d |  j  _ |  j d t |  j  ƒ d ƒ d |  j j j _ |  j d t |  j j ƒ d ƒ |  j d t |  j j ƒ d ƒ d  S(   Ni   t
   known_attrs+   set attributes not in dir listing of methodsB   set attribute on unbound method implementation in class not in dirsK   set attribute on unbound method implementations, should show up in next dir(   R   R   t   assertInt   dirR   R   t   im_funcR	   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_dir_includes_correct_attrs%   s    c         C   s    d „  } |  j  |  j | ƒ d  S(   Nc           S   s   d S(   s   my docstringi   (    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt	   duplicate4   s    (   t   assertNotEqualR   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt    test_duplicate_function_equality2   s    	c         C   sB   d „  } |  j  | ƒ  d  ƒ |  j j | _ |  j  | ƒ  d ƒ d  S(   Nc           S   s   d  S(   N(    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test:   t    i   (   R   t   NoneR   t	   func_code(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_copying_func_code9   s    	c         C   s6   |  j  |  j j t ƒ  ƒ |  j |  j d d t ƒ d  S(   Nt   func_globalsi   (   t   assertIsR   R#   t   globalsR   t	   TypeError(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_globals?   s    c            sx   d ‰  ‡  f d †  } | j  } |  j | t ƒ |  j t | ƒ d ƒ |  j | d j j d ƒ |  j | d | t ƒ d  S(   Ni   c              s	   ˆ  GHd  S(   N(    (    (   R   (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR   E   R   i   i    t   cellt   func_closure(	   R)   t   assertIsInstancet   tupleR   t   lent	   __class__R   R   R&   (   R   R   t   c(    (   R   s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_closureC   s    	c            sL   ‡  f d †  } y | j  d j Wn t k
 r4 n X|  j d ƒ d ‰  d  S(   Nc              s	   ˆ  GHd  S(   N(    (    (   R   (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR   N   R   i    s'   shouldn't be able to read an empty celli   (   R)   t   cell_contentst
   ValueErrorR   (   R   R   (    (   R   s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_empty_cellM   s    c         B   sQ  |  j  |  j j d ƒ |  j  |  j j d ƒ d |  j _ |  j  |  j j d ƒ |  j  |  j j d ƒ d |  j _ |  j  |  j j d ƒ |  j  |  j j d ƒ |  j |  j d d e ƒ |  j |  j d d e ƒ d } | i i  d 6U|  j  |  j j j d	 ƒ |  j  |  j j j d	 ƒ |  j |  j j d d	 e	 ƒ |  j |  j j d d	 e	 ƒ d  S(
   NR   R.   t   dR   i   t	   func_names   def f(): pass
f.__name__t   __builtins__R   (
   R   R   R   R4   R   R&   R   R   R	   t   AttributeError(   R   t   s(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_nameW   s     c            sK  d	 \ ‰  ‰ d „  } d „  } ‡  f d †  } ‡ f d †  } ‡  ‡ f d †  } x9 | | | | | g D]" } |  j  t | j ƒ t j ƒ qd W|  j  | ƒ  d ƒ |  j  | ƒ  d ƒ | j | _ |  j  | j | j ƒ |  j  | ƒ  d ƒ y | j | _ Wn t k
 rn X|  j d ƒ y | j | _ Wn t k
 r9n X|  j d ƒ d  S(
   Ni   i   c           S   s   d  S(   N(    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR   o   R   c           S   s   d S(   Ni   (    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR   p   R   c              s   ˆ  S(   N(    (    (   t   num_one(    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR.   q   R   c              s   ˆ  S(   N(    (    (   t   num_two(    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR3   r   R   c              s
   ˆ  ˆ f S(   N(    (    (   R9   R:   (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   es   R   sD   func_code with different numbers of free vars should not be possible(   i   i   (   R   t   typeR!   t   typest   CodeTypeR1   R   (   R   R   R   R.   R3   R;   t   func(    (   R9   R:   s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_codem   s.    		 c         C   s9   |  j  |  j j d  ƒ |  j ` |  j  |  j j d  ƒ d  S(   N(   R   R   t   func_defaultsR    (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_blank_func_defaults‹   s    	c         C   så   d „  } d d d „ } |  j  | j d  ƒ |  j  | j d	 ƒ d
 | _ |  j  | j d ƒ |  j  | ƒ  d ƒ |  j  | d ƒ d ƒ |  j  | d d ƒ d ƒ | ` |  j  | j d  ƒ y | ƒ  Wn t k
 rÓ n X|  j d ƒ d  S(   Nc         S   s   |  | S(   N(    (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt
   first_func‘   s    i   i   c         S   s   |  | S(   N(    (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   second_func“   s    i   i   i   sF   func_defaults does not update; deleting it does not remove requirement(   i   i   (   i   i   (   i   i   (   R   RA   R    R&   R   (   R   RC   RD   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_default_args�   s     		(   R   R   R   R   R   R"   R'   R/   R2   R8   R@   RB   RE   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR       s   						
	
			t   InstancemethodAttrTestc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sz   |  j  |  j j j |  j ƒ |  j  |  j j j |  j ƒ |  j |  j j d |  j t ƒ |  j |  j j d |  j t ƒ d  S(   Nt   im_class(   R   R   R   RG   R	   R   R&   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_im_class¨   s    c         C   s‰   |  j  |  j _  |  j |  j j  j |  j  ƒ |  j |  j j  j |  j  ƒ |  j |  j j  d |  j  t ƒ |  j |  j j  d |  j  t ƒ d  S(   NR   (   R   R   R   R   R	   R   R&   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_im_func®   s
    c         C   st   |  j  |  j j j d  ƒ |  j  |  j j j |  j ƒ |  j |  j j d d  t ƒ |  j |  j j d |  j t ƒ d  S(   Nt   im_self(   R   R   R   RJ   R    R	   R   R&   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_im_selfµ   s    c         C   sÐ   t  j t d  |  j ƒ |  j _ |  j |  j j ƒ  t |  j ƒ ƒ |  j |  j j ƒ  t |  j ƒ ƒ y |  j j j Wn t	 k
 r† n X|  j
 d ƒ |  j |  j j d d t	 ƒ |  j |  j j d d t	 ƒ d  S(   Ns4   using unknown attributes should raise AttributeErrort   unknown_attri   (   R=   t
   MethodTypet   idR    R   R   R	   R   RL   R6   R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_im_func_non_method»   s    ""c         C   sH   d |  j  j j _ |  j |  j  j j d ƒ |  j |  j j j d ƒ d  S(   Ni   (   R   R   R   R   R   R	   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_implicit_method_propertiesÌ   s    (   R   R   RH   RI   RK   RO   RP   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyRF   §   s
   				t   ArbitraryFunctionAttrTestc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   sw   d |  j  _ |  j |  j  j d ƒ xN |  j j |  j j g D]4 } y d | _ Wn t k
 ra q; X|  j d ƒ q; Wd  S(   Ni   s0   setting attributes on methods should raise error(   R   R   R   R   R   R	   R6   R   (   R   R?   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_set_attrÓ   s    c         C   s2   y |  j  ` Wn t k
 r  n X|  j d ƒ d  S(   Ns1   deleting unknown attribute should raise TypeError(   R   RL   R6   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_delete_unknown_attrß   s
    c         C   s•   y |  j  |  j  j _ Wn t k
 r) n X|  j d ƒ |  j  |  j  j j _ xB |  j  j |  j j |  j j j g D] } |  j | j |  j  ƒ qq Wd  S(   NsL   setting arbitrary attribute in unbound function  should raise AttributeError(   R   R   t   klassR6   R   R   R	   R   (   R   t   method(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_setting_attrs_duplicatesç   s    +c         C   sY   xR |  j  |  j j |  j j g D]2 } y | j Wn t k
 rC q X|  j d ƒ q Wd  S(   Ns4   using unknown attributes should raise AttributeError(   R   R   R   R	   t   non_existent_attrR6   R   (   R   R?   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_unset_attró   s    %(   R   R   RR   RS   RV   RX   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyRQ   Ò   s   			t   FunctionDictsTestc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s—   |  j  |  j d d  t ƒ |  j  |  j d d  t ƒ d d l m } | i d d 6ƒ } |  j  |  j j j d | t ƒ |  j  |  j j j d | t ƒ d  S(   Nt   __dict__t	   func_dictiÿÿÿÿ(   t   UserDicti   R   (	   R   R   R    R&   R\   R   R   R   R	   (   R   R\   R3   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_setting_dict_to_invalidÿ   s    c         C   sy  i d d 6} | |  j  _ | |  j j j _ |  j | |  j  j ƒ |  j | |  j  j ƒ |  j | |  j j j j ƒ |  j | |  j j j ƒ |  j | |  j j j j ƒ |  j | |  j j j ƒ |  j |  j  j	 d ƒ |  j |  j  j d d ƒ |  j |  j  j d d ƒ |  j |  j j j j	 d ƒ |  j |  j j j	 d ƒ |  j |  j j j j	 d ƒ |  j |  j j j	 d ƒ d  S(   Ni   R   (
   R   RZ   R   R   R   R$   R[   R	   R   R   (   R   R3   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_setting_dict_to_valid  s     c         C   s`   y |  j  ` Wn t k
 r  n X|  j d ƒ y |  j  ` Wn t k
 rN n X|  j d ƒ d  S(   Ns3   deleting function dictionary should raise TypeError(   R   RZ   R&   R   R[   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_delete_func_dict  s    c         C   s   |  j  |  j j i  ƒ d  S(   N(   R   R   RZ   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_unassigned_dict,  s    c         C   s4   d } i  } | | |  j  <|  j | |  j  | ƒ d  S(   Ns   Some string(   R   R   (   R   R   R3   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_as_dict_key/  s    (   R   R   R]   R^   R_   R`   Ra   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyRY   þ   s
   				t   FunctionDocstringTestc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sè   |  j  |  j j d  ƒ |  j  |  j j d  ƒ d } | |  j _ |  j j j _ |  j  |  j j | ƒ |  j  |  j j | ƒ |  j  |  j j j | ƒ |  j  |  j j j | ƒ |  j	 |  j j d | t
 ƒ |  j	 |  j j d | t
 ƒ d  S(   Ns   A test method that does nothingt   __doc__(   R   R   Rc   R    t   func_docR   R   R   R	   R   R6   (   R   t   docstr(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_set_docstring_attr7  s    c         C   s†   d |  j  _ |  j  ` |  j |  j  j d  ƒ |  j |  j  j d  ƒ d |  j  _ |  j  ` |  j |  j  j d  ƒ |  j |  j  j d  ƒ d  S(   Ns   The docstring(   R   Rc   R   R    Rd   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_delete_docstringC  s    		(   R   R   Rf   Rg   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyRb   6  s   	t   StaticMethodAttrsTestc           B   s   e  Z d  „  Z RS(   c         C   sQ   d „  } t  | ƒ } |  j | j | k ƒ t | ƒ } |  j | j | k ƒ d  S(   Nc           S   s   d  S(   N(    (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyR   P  s    (   t   classmethodt
   assertTruet   __func__t   staticmethod(   R   R   R.   R7   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   test_func_attributeO  s
    	(   R   R   Rm   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyRh   N  s   c           C   s    t  j t t t t t t ƒ d  S(   N(   R    t   run_unittestR   RF   RQ   RY   Rb   Rh   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt	   test_mainZ  s    t   __main__(   R   R    R=   t   unittestt   TestCaseR   R   RF   RQ   RY   Rb   Rh   Ro   R   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_funcattrs.pyt   <module>   s   ‡+,8	