+
    DfjC                     L    R t ^ RIHt ^ RIHt ^RIHtHtHt  ! R R]4      t	R# )z(
Tests for L{twisted._threads._memory}.
)verifyObject)SynchronousTestCase)AlreadyQuitIWorkercreateMemoryWorkerc                   Z   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
MemoryWorkerTestsz
Tests for L{MemoryWorker}.
c                   < V ^8  d   QhRR/#    returnN )format__classdict__s   "C/usr/lib/python3/dist-packages/twisted/_threads/test/test_memory.py__annotate__MemoryWorkerTests.__annotate__   s     ' 'T '    c                f  a \        4       w  r\        \        V4       . oVP                  V3R l4       VP                  V3R l4       V P	                  S. 4       V P	                  V! 4       R4       V P	                  S^.4       V P	                  V! 4       R4       V P	                  S^^.4       R# )z
L{createMemoryWorker} creates an L{IWorker} and a callable that can
perform work on it.  The performer returns C{True} if it accomplished
useful work.
c                  &   < S P                  ^4      # )   appenddones   r   <lambda>?MemoryWorkerTests.test_createWorkerAndPerform.<locals>.<lambda>       $++a.r   c                  &   < S P                  ^4      # )   r   r   s   r   r   r      r   r   TN)r   r   r   doassertEqual)selfworker	performerr   s   &  @r   test_createWorkerAndPerform-MemoryWorkerTests.test_createWorkerAndPerform   s     /0Wf%		()		()r"d+s#d+1v&r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r   $   s     - - -r   c                \  a \        4       w  r. oR V3R llpVP                  V4       VP                  4        V P                  \        VP                  V4       V P                  \        VP                  4       V! 4        V P                  S^.4       V P                  V! 4       R4       R# )z
Calling C{quit} on the worker returned by L{createMemoryWorker} causes
its C{do} and C{quit} methods to raise L{AlreadyQuit}; its C{perform}
callable will start raising L{AlreadyQuit} when the work already
provided to C{do} has been exhausted.
c                    V ^8  d   QhRR/# r
   r   )r   s   "r   r   6MemoryWorkerTests.test_quitQuits.<locals>.__annotate__.   s     	 	$ 	r   c                  *   < S P                  ^4       R# )   Nr   r   s   r   moreWork2MemoryWorkerTests.test_quitQuits.<locals>.moreWork.   s    KKNr   FN)r   r    quitassertRaisesr   r!   )r"   r#   r$   r-   r   s   &   @r   test_quitQuits MemoryWorkerTests.test_quitQuits$   s     /0	 	 			(+vyy(;+v{{3s#e,r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r   9   s     - - -r   c                L    \        4       w  rV P                  V! 4       R4       R# )z
The C{perform} callable returned by L{createMemoryWorker} will return
no result when there's no work to do yet.  Since there is no work to
do, the performer returns C{False}.
FN)r   r!   )r"   r#   r$   s   &  r   test_performWhenNothingToDoYet0MemoryWorkerTests.test_performWhenNothingToDoYet9   s!     /0e,r   r   N)
__name__
__module____qualname____firstlineno____doc__r%   r1   r5   __static_attributes____classdictcell__)r   s   @r   r   r      s(     ' '"- -*- -r   r   N)
r;   zope.interface.verifyr   twisted.trial.unittestr    r   r   r   r   r   r   r   <module>rA      s%    / 6 7 72-+ 2-r   