ó
‹wÛjc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z m Z d  d l Z d  d l Z d  d l	 m
 Z d g Z e j r™ e j d d d g ƒ n  g  e D] Z e e f ^ q  Z d „  Z d	 e  j f d
 „  ƒ  YZ d e  j f d „  ƒ  YZ d „  Z e d k re ƒ  n  d S(   iÿÿÿÿN(   t   run_unittestt   check_warnings(   t   systems)   BaseException.message has been deprecateds)   exceptions must derive from BaseExceptionsE   catching classes that don't inherit from BaseException is not alloweds7   __get(item|slice)__ not supported for exception classesc            s   ‡  f d †  } | S(   s%   Ignore the known DeprecationWarnings.c             s*   t  d t t Œ � ˆ  |  | Ž  SWd  QXd  S(   Nt   quiet(   R   t   Truet   _deprecations(   t   argst   kw(   t   func(    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_pep352.pyt   wrapper   s    (    (   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_pep352.pyt   ignore_deprecation_warnings   s    t   ExceptionClassTestsc           B   st   e  Z d  Z d „  Z e d „  ƒ Z d „  Z d Z d „  Z e d „  ƒ Z	 e d „  ƒ Z
 e d „  ƒ Z d „  Z RS(   s]   Tests for anything relating to exception objects themselves (e.g.,
    inheritance hierarchy)c         C   s   |  j  t t t ƒ ƒ d  S(   N(   t
   assertTruet
   issubclasst	   Exceptiont   object(   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_pep352.pyt   test_builtins_new_style!   s    c         C   s>   x7 d D]/ } |  j  t | | ƒ d | j j | f ƒ q Wd  S(   NR   t   messaget   __str__t   __repr__t   __getitem__s   %s missing %s attribute(   R   R   R   R   R   (   R   t   hasattrt	   __class__t   __name__(   R   t   inst   attr(    (    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_pep352.pyt   verify_instance_interface$   s    c         C   sÊ  t  d „  t t ƒ Dƒ ƒ } t t j j t j j t ƒ d d ƒ ƒ } zT| j	 ƒ  j
 ƒ  } y t t | ƒ } Wn" t k
 r“ |  j d | ƒ n X|  j | | ƒ | j | ƒ g  } d } xÚ| D]Ò} | j
 ƒ  } | j d ƒ } | | d }	 d |	 k rR|	 j d ƒ }
 |	 |
 d d	 !} |	 |
 d  }	 t ƒ  | k rR| j |	 ƒ qÄ qRn  d
 |	 k r~|	 j d
 ƒ } |	 | d  }	 n  y t t |	 ƒ } Wn" t k
 rµ|  j d |	 ƒ n X| | k  rØ| j | | f ƒ n4 | | k rx% | d	 d | k r| j ƒ  qçWn  |  j t | | d	 d ƒ d | j | d	 d j f ƒ y |  j | ƒ  ƒ Wn t k
 rln X|  j |	 | ƒ | j |	 ƒ | } | } qÄ WWd  | j ƒ  X|  j t | ƒ d d | ƒ d  S(   Nc         s   s$   |  ] } | j  d  ƒ s | Vq d S(   t   _N(   t
   startswith(   t   .0t   x(    (    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_pep352.pys	   <genexpr>-   s    i    s   exception_hierarchy.txts   base class %s not a built-int   -i   t   (i   iÿÿÿÿt   [s   %s not a built-in exceptions   %s is not a subclass of %ss   %s not accounted for(   t   sett   dirt
   exceptionst   opent   ost   patht   joint   splitt   __file__t   readlinet   rstript   getattrt   __builtin__t   AttributeErrort   failt   assertInt   discardt   rindext   indext   platform_systemt   appendt   popR   R   R   R   t	   TypeErrort   closet   assertEqualt   len(   R   t   exc_sett   inheritance_treet   superclass_namet   last_exct   superclassest
   last_deptht   exc_linet   deptht   exc_namet   paren_indext   platform_namet   left_brackett   exc(    (    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_pep352.pyt   test_inheritance+   sb    		t   lengthR   R   t   strt   unicodet   reprt   indexingc         C   sM   xF t  |  j | ƒ D]2 \ } \ } } |  j | | d | | | f ƒ q Wd  S(   Ns   %s: %s != %s(   t   zipt   interface_testsR;   (   R   t   resultst	   test_namet   givent   expected(    (    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_pep352.pyt   interface_test_driverc   s    %c      	   C   s°   d } t  | ƒ } t | j ƒ d g | j d | g | j | g t | ƒ t | ƒ g t | ƒ t | ƒ g t | ƒ | j j t | j ƒ g | d | g f } |  j	 | ƒ d  S(   Nt   spami   i    (
   R   R<   R   R   RL   RM   RN   R   R   RV   (   R   t   argRI   RR   (    (    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_pep352.pyt   test_interface_single_argh   s    .*"c      	   C   sÂ   d } t  t | ƒ ƒ } t | Œ  } t | j ƒ | g | j | g | j d g t | ƒ t | ƒ g t | ƒ t | ƒ g t | ƒ | j	 j
 t | j ƒ g | d | d g f } |  j | ƒ d  S(   Ni   t    iÿÿÿÿ(   t   tuplet   rangeR   R<   R   R   RL   RM   RN   R   R   RV   (   R   t	   arg_countR   RI   RR   (    (    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_pep352.pyt   test_interface_multi_args   s    !"c         C   s�   t  ƒ  } t | j ƒ d g | j t ƒ  g | j d g t | ƒ d g t | ƒ d g t | ƒ | j j	 d g t
 t
 g f } |  j | ƒ d  S(   Ni    RZ   u    s   ()(   R   R<   R   R[   R   RL   RM   RN   R   R   R   RV   (   R   RI   RR   (    (    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_pep352.pyt   test_interface_no_arg€   s    	!(c         C   s'   t  d t f ƒ � t ƒ  j Wd  QXd  S(   NRZ   (   R   t   DeprecationWarningt   BaseExceptionR   (   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_pep352.pyt   test_message_deprecation‹   s    (   RK   R   R   RL   RM   RN   RO   (   R   t
   __module__t   __doc__R   R
   R   RJ   RQ   RV   RY   R^   R_   Rb   (    (    (    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_pep352.pyR      s   		5 	t
   UsageTestsc           B   sJ   e  Z d  Z d „  Z d „  Z e d „  ƒ Z d „  Z d „  Z d „  Z	 RS(   s   Test usage of exceptionsc         C   s:   y
 | ‚ Wn t  k
 r d SX|  j d t | ƒ ƒ d S(   s6   Make sure that raising 'object_' triggers a TypeError.Ns!   TypeError expected for raising %s(   R9   R1   t   type(   R   t   object_(    (    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_pep352.pyt   raise_fails•   s
    
c         C   sÂ   y" y
 t  ‚ Wn | k
 r  n XWn8 t k
 r5 n( t  k
 r\ |  j d t | ƒ ƒ n Xy% y
 t  ‚ Wn | f k
 r€ n XWn9 t k
 r– d St  k
 r½ |  j d t | ƒ ƒ n Xd S(   s,   Catching 'object_' should raise a TypeError.s#   TypeError expected when catching %sNs;   TypeError expected when catching %s as specified in a tuple(   t   StandardErrorR9   R1   Rf   (   R   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_pep352.pyt   catch_fails�   s&    

	c         C   s|   d d d „  ƒ  Y} y
 | ‚ Wn$ | k
 r0 n |  j  d ƒ n Xy | ƒ  ‚ Wn$ | k
 rd n |  j  d ƒ n Xd  S(   Nt   ClassicClassc           B   s   e  Z RS(    (   R   Rc   (    (    (    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_pep352.pyRk   ·   s   s   unable to raise classic classs&   unable to raise classic class instance(    (   R1   (   R   Rk   (    (    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_pep352.pyt   test_raise_classic´   s    
c         C   s7   d t  f d „  ƒ  Y} |  j | ƒ |  j | ƒ  ƒ d  S(   Nt   NewStyleClassc           B   s   e  Z RS(    (   R   Rc   (    (    (    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_pep352.pyRm   Ë   s   (   R   Rh   (   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_pep352.pyt"   test_raise_new_style_non_exceptionÆ   s    c         C   s   |  j  d ƒ d  S(   NRW   (   Rh   (   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_pep352.pyt   test_raise_stringÐ   s    c         C   s¢   t  j ƒ  �� t  j ƒ  t  j d ƒ d } |  j t ƒ �# y
 t ‚ Wn | k
 rW n XWd  QX|  j t ƒ �) y
 t ‚ Wn t | f k
 r‘ n XWd  QXWd  QXd  S(   Nt   errorRW   (   t   warningst   catch_warningst   resetwarningst   filterwarningst   assertRaisesR`   Ri   t   AssertionError(   R   t   str_exc(    (    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_pep352.pyt   test_catch_stringÔ   s    



(
   R   Rc   Rd   Rh   Rj   R
   Rl   Rn   Ro   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_pep352.pyRe   ‘   s   			
	c           C   s   t  t t ƒ d  S(   N(   R    R   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_pep352.pyt	   test_mainé   s    t   __main__(   t   unittestR/   R%   Rq   t   test.test_supportR    R   R'   t   syst   platformR   R6   t   DEPRECATION_WARNINGSt   py3kwarningt   extendt   msgR`   R   R
   t   TestCaseR   Re   Ry   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_pep352.pyt   <module>   s(   			uX	