Your IP : 216.73.216.213
�
��f�U c
@ sS d Z d d l Z d d l Z d d l Z d d l Td d l m Z y d d l Z Wn e k
rn e Z Yn XGd d � d e j
� Z Gd d � d e j
� Z Gd d
� d
e j
� Z
e j e d � Gd d
� d
e j
� � Z Gd d � d e � Z Gd d � d e j
� Z Gd d � d e j
� Z d d � Z e d k rOe � n d S( u9 Unit tests for contextlib.py, and other context managers.i N( u *( u supportc B s� | Ee Z d Z d d � Z d d � Z d d � Z d d � Z d d
� Z d d � Z d
d � Z e
j e j
j d k d � d d � � Z d S( u ContextManagerTestCasec s} g � t � f d d � � } | � �7 } | j � d g � | j | d � � j | � Wd QX| j � d d d g � d S( Nc 3 s# � j d � d V� j d � d S( Ni i* i� ( u append( ( u state( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu woohoo s
u@ ContextManagerTestCase.test_contextmanager_plain.<locals>.woohooi i* i� ( u contextmanageru assertEqualu append( u selfu woohoou x( ( u stateu9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_plain s u0 ContextManagerTestCase.test_contextmanager_plainc s� g � t � f d d � � } | j t � �P | � �@ } | j � d g � | j | d � � j | � t � � Wd QXWd QX| j � d d d g � d S( Nc 3 s+ � j d � z d VWd � j d � Xd S( Ni i* i� ( u append( ( u state( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu woohoo s
uB ContextManagerTestCase.test_contextmanager_finally.<locals>.woohooi i* i� ( u contextmanageru assertRaisesu ZeroDivisionErroru assertEqualu append( u selfu woohoou x( ( u stateu9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_finally s
u2 ContextManagerTestCase.test_contextmanager_finallyc C sK t d d � � } | � } | j � | j | j t t d � d � � d S( Nc s s d Vd S( N( ( ( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu whee/ s uC ContextManagerTestCase.test_contextmanager_no_reraise.<locals>.wheeu foo( u contextmanageru __enter__u assertFalseu __exit__u TypeErroru None( u selfu wheeu ctx( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_no_reraise. s
u5 ContextManagerTestCase.test_contextmanager_no_reraisec C sK t d d � � } | � } | j � | j t | j t t d � d � d S( Nc s s y d VWn
d VYn Xd S( N( ( ( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu whoo8 s uO ContextManagerTestCase.test_contextmanager_trap_yield_after_throw.<locals>.whoou foo( u contextmanageru __enter__u assertRaisesu RuntimeErroru __exit__u TypeErroru None( u selfu whoou ctx( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu* test_contextmanager_trap_yield_after_throw7 s
uA ContextManagerTestCase.test_contextmanager_trap_yield_after_throwc s� g � t � � f d d � � } | � �C } � j � d g � � j | d � � j | � t d � � Wd QX� j � d d d g � d S( Nc 3 so � j d � y d VWnR t k
rj } z2 � j | j d � � j � d d d g � WYd d } ~ Xn Xd S( Ni i* i i� ( u appendu ZeroDivisionErroru argsu assertEqual( u e( u selfu state( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu woohooF s
uA ContextManagerTestCase.test_contextmanager_except.<locals>.woohooi i* i� ( u contextmanageru assertEqualu appendu ZeroDivisionError( u selfu woohoou x( ( u selfu stateu9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_exceptD s
u1 ContextManagerTestCase.test_contextmanager_exceptc C s1 d d � } t | d d � d d � � � } | S( Nc s � f d d � } | S( Nc s1 x* � j � D] \ } } t | | | � q
W| S( N( u itemsu setattr( u funcu ku v( u kw( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu decorateW s uX ContextManagerTestCase._create_contextmanager_attribs.<locals>.attribs.<locals>.decorate( ( u kwu decorate( ( u kwu9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu attribsV s uF ContextManagerTestCase._create_contextmanager_attribs.<locals>.attribsu foou barc S s d S( u Whee!N( ( u spam( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu baz\ s uB ContextManagerTestCase._create_contextmanager_attribs.<locals>.baz( u contextmanager( u selfu attribsu baz( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu _create_contextmanager_attribsU s u5 ContextManagerTestCase._create_contextmanager_attribsc C s6 | j � } | j | j d � | j | j d � d S( Nu bazu bar( u _create_contextmanager_attribsu assertEqualu __name__u foo( u selfu baz( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_attribsb s u2 ContextManagerTestCase.test_contextmanager_attribsi u) Docstrings are omitted with -O2 and abovec C s# | j � } | j | j d � d S( Nu Whee!( u _create_contextmanager_attribsu assertEqualu __doc__( u selfu baz( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu test_contextmanager_doc_attribg s u5 ContextManagerTestCase.test_contextmanager_doc_attribN( u __name__u
__module__u __qualname__u test_contextmanager_plainu test_contextmanager_finallyu test_contextmanager_no_reraiseu* test_contextmanager_trap_yield_after_throwu test_contextmanager_exceptu _create_contextmanager_attribsu test_contextmanager_attribsu unittestu skipIfu sysu flagsu optimizeu test_contextmanager_doc_attrib( u
__locals__( ( u9 /opt/alt/python33/lib64/python3.3/test/test_contextlib.pyu ContextManagerTestCase s
u ContextManagerTestCasec B s, | Ee Z d Z d d � Z d d � Z d S( u ClosingTestCasec
st g � G� f d d � d � } | � } | j � g � t | � � } | j | | � Wd QX| j � d g � d S( Nc s&