
    h                     6    S r SSKJr  SSKJr   " S S\5      rg)z&
Tests for L{twisted.python.context}.
    )context)SynchronousTestCasec                   0    \ rS rSrSrS rS rS rS rSr	g)	ContextTests   z@
Tests for the module-scope APIs for L{twisted.python.context}.
c                 N    U R                  [        R                  " S5      5        g)z\
Arbitrary keys which have not been set in the context have an associated
value of L{None}.
xN)assertIsNoner   getselfs    `/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/test/test_context.pytest_notPresentIfNotSet$ContextTests.test_notPresentIfNotSet   s    
 	'++c*+    c                 t    U R                  [        R                  " SS0[        R                  S5      S5        g)z}
Values may be associated with keys by passing them in a dictionary as
the first argument to L{twisted.python.context.call}.
r	   yN)assertEqualr   callr   r   s    r   test_setByCallContextTests.test_setByCall   s)    
 	sCj'++sCSIr   c                     [         R                  " SS0S 5        U R                  [         R                  " S5      5        g)z
After a L{twisted.python.context.call} completes, keys specified in the
call are no longer associated with the values from that call.
r	   r   c                      g )N r   r   r   <lambda>2ContextTests.test_unsetAfterCall.<locals>.<lambda>%   s    r   N)r   r   r
   r   r   s    r   test_unsetAfterCall ContextTests.test_unsetAfterCall    s-    
 	c3Z.'++c*+r   c                     [        5       nU R                  [        R                  R                  US5        [        R
                  " US5        U R                  S[        R                  " U5      5        g)za
A default value may be set for a key in the context using
L{twisted.python.context.setDefault}.
Nr   )object
addCleanupr   defaultContextDictpop
setDefaultr   r   )r   keys     r   test_setDefaultContextTests.test_setDefault(   sP    
 h2266TB3$gkk#./r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r&   __static_attributes__r   r   r   r   r      s    ,J,0r   r   N)r,   twisted.pythonr   twisted.trial.unittestr   r   r   r   r   <module>r0      s   
 # 6#0& #0r   