
    Vh
                     F    d Z ddlmZ ddlmZmZ ddlmZ  G d de      Zy)z
Tests for L{twisted.internet._baseprocess} which implements process-related
functionality that is useful in all platforms supporting L{IReactorProcess}.
    )BaseProcess)getWarningMethodsetWarningMethod)TestCasec                       e Zd ZdZd Zd Zy)BaseProcessTestsz
    Tests for L{BaseProcess}, a parent class for other classes which represent
    processes which implements functionality common to many different process
    implementations.
    c                 "    G d d      }t        d      }t         |             }|j                  |       |j                  j                  j                  t                | j                  ||j                  j                  j                         y)z
        L{BaseProcess._callProcessExited} calls the C{processExited} method of
        its C{proto} attribute and passes it a L{Failure} wrapping the given
        exception.
        c                       e Zd ZdZd Zy):BaseProcessTests.test_callProcessExited.<locals>.FakeProtoNc                     || _         y N)reason)selfr   s     V/home/dcms/DCMS/lib/python3.12/site-packages/twisted/internet/test/test_baseprocess.pyprocessExitedzHBaseProcessTests.test_callProcessExited.<locals>.FakeProto.processExited   s	    $    )__name__
__module____qualname__r   r    r   r   	FakeProtor      s    F%r   r   zfake reasonN)RuntimeErrorr   _callProcessExitedprotor   trapassertIsvalue)r   r   r   processs       r   test_callProcessExitedz'BaseProcessTests.test_callProcessExited   sh    	% 	% m,ik*""6*!!,/fgmm22889r   c                     G d d      }t               }t         |             }| j                  t        t	                      g fd}t        |       |j                  |       \  \  }}}| j                  |d|j                  d|j                  d       | j                  |t               | j                  |d       y)	z
        L{BaseProcess._callProcessExited} emits a L{DeprecationWarning} if the
        object referred to by its C{proto} attribute has no C{processExited}
        method.
        c                       e Zd Zy)ABaseProcessTests.test_callProcessExitedMissing.<locals>.FakeProtoN)r   r   r   r   r   r   r   r"   /   s    r   r   c                 .    j                  | ||f       y r   )append)messagecategory
stacklevelwarningss      r   collectz?BaseProcessTests.test_callProcessExitedMissing.<locals>.collect8   s    OOWh
;<r   z@Since Twisted 8.2, IProcessProtocol.processExited is required.  .z must implement it.r   N)objectr   
addCleanupr   r   r   assertEqualr   r   r   DeprecationWarning)	r   r   r   r   r)   r%   r&   r'   r(   s	           @r   test_callProcessExitedMissingz.BaseProcessTests.test_callProcessExitedMissing(   s    	 	 ik*(*:*<=	= 	!""6*,4)	('8Z*3*>*>	@R@RT	

 	h 23 	Q'r   N)r   r   r   __doc__r   r/   r   r   r   r   r      s    :&#(r   r   N)	r0   twisted.internet._baseprocessr   twisted.python.deprecater   r   twisted.trial.unittestr   r   r   r   r   <module>r4      s!   
 6 G +=(x =(r   