
    Yf
                     N    d Z ddlmZ ddlmZmZ ddlmZ  G d de          ZdS )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dS )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                            t                      |                     ||j        j        j                   dS )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dS ):BaseProcessTests.test_callProcessExited.<locals>.FakeProtoNc                     || _         d S N)reason)selfr   s     X/var/www/html/env/lib/python3.11/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   s    	% 	% 	% 	% 	% 	% 	% 	% m,,iikk**""6***!!,///fgm2899999r   c                     G d d          }t                      }t           |                      }|                     t          t	                                 g fd}t          |           |                    |           \  \  }}}|                     |d|j        d|j        d           | 	                    |t                     |                     |d           dS )	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dS )ABaseProcessTests.test_callProcessExitedMissing.<locals>.FakeProtoN)r   r   r   r   r   r   r   r"   /   s        Dr   r   c                 8                         | ||f           d S 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%   	 	 	 	 	 	 	 	 iikk**(*:*<*<===	= 	= 	= 	= 	= 	!!!""6***,4)	('8ZG*3*>*>*>	@R@R@RT	
 	
 	

 	h 233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 5 5 5 5 5 G G G G G G G G + + + + + +=( =( =( =( =(x =( =( =( =( =(r   