
    Yfe                         d Z ddlZddlmZ ddlmZ  G d dej                  Z G d d          Z G d	 d
ej                  Z	dS )z
Sample test cases defined using the standard library L{unittest.TestCase}
class which are used as data by test cases which are actually part of the
trial test suite to verify handling of handling of such cases.
    N)exc_info)Failurec                   R    e Zd Zd Zd Zd Z ej        d          d             ZdS )
PyUnitTestc                     dS )z!
        A passing test.
        N selfs    P/var/www/html/env/lib/python3.11/site-packages/twisted/trial/test/pyunitcases.py	test_passzPyUnitTest.test_pass             c                      t          d          )zE
        A test which raises an exception to cause an error.
        zpyunit error)	Exceptionr	   s    r   
test_errorzPyUnitTest.test_error   s     '''r   c                 0    |                      d           dS )zQ
        A test which uses L{unittest.TestCase.fail} to cause a failure.
        zpyunit failureN)failr	   s    r   	test_failzPyUnitTest.test_fail   s     			"#####r   zpyunit skipc                     dS )zS
        A test which uses the L{unittest.skip} decorator to cause a skip.
        Nr   r	   s    r   	test_skipzPyUnitTest.test_skip"   r   r   N)	__name__
__module____qualname__r   r   r   unittestskipr   r   r   r   r   r      si          
( ( ($ $ $ X]=!!  "!  r   r   c                       e Zd ZdZdefdZdS )_NonStringIdz
    A class that looks a little like a TestCase, but not enough so to
    actually be used as one.  This helps L{BrokenRunInfrastructure} use some
    interfaces incorrectly to provoke certain failure conditions.
    returnc                     t                      S )N)objectr	   s    r   idz_NonStringId.id0   s    xxr   N)r   r   r   __doc__r    r!   r   r   r   r   r   )   s9         F      r   r   c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
BrokenRunInfrastructurezu
    A test suite that is broken at the level of integration between
    L{TestCase.run} and the results object.
    c                 >     t          | | j                  |          S )z
        Override the normal C{run} behavior to pass the result object
        along to the test method.  Each test method needs the result object so
        that it can implement its particular kind of brokenness.
        )getattr_testMethodNamer
   results     r   runzBrokenRunInfrastructure.run:   s!     3wtT1226:::r   c                 H    |                     t                                 dS )zA
        Violate the L{TestResult.addSuccess} interface.
        N)
addSuccessr   r(   s     r   test_addSuccessz'BrokenRunInfrastructure.test_addSuccessB   s"    
 	,..)))))r   c                     	 t          d          # t          $ r t                      }Y nw xY w|                    t	                      |           dS )z?
        Violate the L{TestResult.addError} interface.
        test_addErrorN)r   BaseExceptionr   addErrorr   r
   r)   errs      r   r/   z%BrokenRunInfrastructure.test_addErrorI   s]    	O,,, 	 	 	**CCC	 	,,,,,    ,,c                     	 t          d          # t          $ r t                      }Y nw xY w|                    t	                      |           dS )zA
        Violate the L{TestResult.addFailure} interface.
        test_addFailureN)r   r0   r   
addFailurer   r2   s      r   r6   z'BrokenRunInfrastructure.test_addFailureT   s`    	-... 	 	 	**CCC	 	,..#.....r4   c                 J    |                     t                      d           dS )z>
        Violate the L{TestResult.addSkip} interface.
        test_addSkipN)addSkipr   r(   s     r   r9   z$BrokenRunInfrastructure.test_addSkip_   s"     	|~~~66666r   c                     	 t          d          # t          $ r t                      }Y nw xY w|                    t	                      |           dS )zI
        Violate the L{TestResult.addExpectedFailure} interface.
        test_addExpectedFailureN)r   r0   r   addExpectedFailurer   r2   s      r   r<   z/BrokenRunInfrastructure.test_addExpectedFailuree   s^    	5666 	 	 	))CCC	!!,..#66666r4   c                 H    |                     t                                 dS )zK
        Violate the L{TestResult.addUnexpectedSuccess} interface.
        N)addUnexpectedSuccessr   r(   s     r   test_addUnexpectedSuccessz1BrokenRunInfrastructure.test_addUnexpectedSuccesso   s"     	##LNN33333r   N)r   r   r   r"   r*   r-   r/   r6   r9   r<   r@   r   r   r   r$   r$   4   s         
; ; ;* * *	- 	- 	-	/ 	/ 	/7 7 77 7 74 4 4 4 4r   r$   )
r"   r   sysr   twisted.python.failurer   TestCaser   r   r$   r   r   r   <module>rD      s            * * * * * *    "   2       ?4 ?4 ?4 ?4 ?4h/ ?4 ?4 ?4 ?4 ?4r   