%PDF- %PDF-
Direktori : /usr/local/lib/python2.7/test/ |
Current File : //usr/local/lib/python2.7/test/test_contextlib.pyo |
ó Nêáac @ s 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 rm d Z n Xd e j f d „ ƒ YZ d e j f d „ ƒ YZ d e j f d „ ƒ YZ d e j f d „ ƒ YZ e j e d ƒ d e j f d „ ƒ Yƒ Z d „ Z e d k re ƒ n d S( s9 Unit tests for contextlib.py, and other context managers.iÿÿÿÿN( t *( t test_supportt ContextManagerTestCasec B sw e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z e j e j j d k d ƒ d „ ƒ Z d „ Z RS( c sz g ‰ t ‡ f 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ç ( t append( ( t state( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt woohoo s i i* iç ( t contextmanagert assertEqualR ( t selfR t x( ( R s0 /usr/local/lib/python2.7/test/test_contextlib.pyt test_contextmanager_plain s c s™ g ‰ t ‡ f 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ç ( R ( ( R ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyR s i i* iç ( R t assertRaisest ZeroDivisionErrorR R ( R R R ( ( R s0 /usr/local/lib/python2.7/test/test_contextlib.pyt test_contextmanager_finally s c C sH t d „ ƒ } | ƒ } | j ƒ | j | j t t d ƒ d ƒ ƒ d S( Nc s s d Vd S( N( ( ( ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt whee/ s t foo( R t __enter__t assertFalset __exit__t TypeErrort None( R R t ctx( ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt test_contextmanager_no_reraise. s c C sH t d „ ƒ } | ƒ } | j ƒ | j t | j t t d ƒ d ƒ d S( Nc s s y d VWn d Vn Xd S( N( ( ( ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt whoo8 s R ( R R R t RuntimeErrorR R R ( R R R ( ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt* test_contextmanager_trap_yield_after_throw7 s c s‰ g ‰ t ‡ ‡ f d † ƒ } | ƒ C } ˆ j ˆ d g ƒ ˆ j | d ƒ ˆ j | ƒ t d ƒ ‚ Wd QXˆ j ˆ d d d g ƒ d S( Nc 3 s] ˆ j d ƒ y d VWn@ t k rX } ˆ j | j d ƒ ˆ j ˆ d d d g ƒ n Xd S( Ni i* i iç ( R R t argsR ( t e( R R ( s0 /usr/local/lib/python2.7/test/test_contextlib.pyR F s i i* iç ( R R R R ( R R R ( ( R R s0 /usr/local/lib/python2.7/test/test_contextlib.pyt test_contextmanager_exceptD s c C s+ d „ } t | d d ƒ d „ ƒ ƒ } | S( Nc s ‡ f d † } | S( Nc s1 x* ˆ j ƒ D] \ } } t | | | ƒ q W| S( N( t itemst setattr( t funct kt v( t kw( s0 /usr/local/lib/python2.7/test/test_contextlib.pyt decorateW s ( ( R"