
    Vh                        d Z ddlmZ ddlmZ ddlmZmZmZ  G d dej                        Z
 G d de
      Z G d	 d
e
      Z G d de
      Zy)z.
Tests for interrupting tests with Control-C.
    )annotations)StringIO)reporterrunnerunittestc                      e Zd ZddZy)	TrialTestc                    t               | _        t        j                         | _        t	        j
                         | _        y N)r   outputr   
TestResultr   
TestLoaderloaderselfs    P/home/dcms/DCMS/lib/python3.12/site-packages/twisted/trial/test/test_keyboard.pysetUpzTrialTest.setUp   s+    j ++-'')    NreturnNone)__name__
__module____qualname__r    r   r   r	   r	      s    *r   r	   c                  f     e Zd ZU ded<    G d dej
                        Zd fdZddZddZ	 xZ
S )	InterruptInTestTestszbool | Nonetest_03_doNothing_runc                  $    e Zd ZddZddZddZy)$InterruptInTestTests.InterruptedTestc                    t         r   )KeyboardInterruptr   s    r   test_02_raiseInterruptz;InterruptInTestTests.InterruptedTest.test_02_raiseInterrupt   s    ##r   c                     y r   r   r   s    r   test_01_doNothingz6InterruptInTestTests.InterruptedTest.test_01_doNothing   s    r   c                    dt         _        y )NT)r   r   r   s    r   test_03_doNothingz6InterruptInTestTests.InterruptedTest.test_03_doNothing   s    9= 6r   Nr   )r   r   r   r#   r%   r'   r   r   r   InterruptedTestr       s    	$		>r   r(   c                    t         |           | j                  j                  t        j
                        | _        d t        _        y r   )superr   r   	loadClassr   r(   suiter   r   	__class__s    r   r   zInterruptInTestTests.setUp"   s2    [[**+?+O+OP
592r   c                    | j                  d| j                  j                                | j                  d| j                  j                         | j                  | j                  j                         y )N   r   )assertEqualr,   countTestCasesr   testsRunassertFalse
shouldStopr   s    r   test_setUpOKz!InterruptInTestTests.test_setUpOK'   sQ    DJJ5578DMM223112r   c                L   t        j                  | j                  g      j                  | j                         | j                  | j                  j                         | j                  d| j                  j                         | j                  t        j                  d       y )N   ztest_03_doNothing ran.)r   
TrialSuiter,   runr   
assertTruer5   r1   r3   r4   r   r   r   s    r   test_interruptInTestz)InterruptInTestTests.test_interruptInTest,   so    4::,'++DMM:001DMM223 668P	
r   r   )r   r   r   __annotations__r   TestCaser(   r   r6   r<   __classcell__r.   s   @r   r   r      s*    &&>(++ >:
3

r   r   c                  j     e Zd ZU dZded<    G d dej                        Zd	 fdZd	dZ	d	dZ
 xZS )
InterruptInSetUpTestsr   booltest_02_runc                  $    e Zd ZddZddZddZy)%InterruptInSetUpTests.InterruptedTestc                6    t         j                  dkD  rt        y Nr   )rB   r3   r"   r   s    r   r   z+InterruptInSetUpTests.InterruptedTest.setUp:   s    $--1'' 2r   c                6    t         xj                  dz  c_        y N   )rB   r3   r   s    r   test_01z-InterruptInSetUpTests.InterruptedTest.test_01>   s    !**a/*r   c                L    t         xj                  dz  c_        dt         _        y NrK   T)rB   r3   rD   r   s    r   test_02z-InterruptInSetUpTests.InterruptedTest.test_02A   s    !**a/*04!-r   Nr   )r   r   r   r   rL   rO   r   r   r   r(   rF   9   s    	(	0	5r   r(   c                    t         |           | j                  j                  t        j
                        | _        dt        _        dt        _        y )NFr   )	r*   r   r   r+   rB   r(   r,   rD   r3   r-   s    r   r   zInterruptInSetUpTests.setUpE   s;    [[**+@+P+PQ
,1))*&r   c                .   | j                  dt        j                         | j                  d| j                  j	                                | j                  d| j
                  j                         | j                  | j
                  j                         y Nr   r8   )r1   rB   r3   r,   r2   r   r4   r5   r   s    r   r6   z"InterruptInSetUpTests.test_setUpOKK   sh    1::;DJJ5578DMM223112r   c                L   t        j                  | j                  g      j                  | j                         | j                  | j                  j                         | j                  d| j                  j                         | j                  t        j                  d       y )Nr8   test_02 ran)r   r9   r,   r:   r   r;   r5   r1   r3   r4   rB   rD   r   s    r   test_interruptInSetUpz+InterruptInSetUpTests.test_interruptInSetUpQ   sl    4::,'++DMM:001DMM223.::MJr   r   )r   r   r   r3   r=   r   r>   r(   r   r6   rU   r?   r@   s   @r   rB   rB   5   s0    H
5(++ 
5+3Kr   rB   c                  j     e Zd ZU dZded<    G d dej                        Zd	 fdZd	dZ	d	dZ
 xZS )
InterruptInTearDownTestsr   rC   rD   c                  $    e Zd ZddZddZddZy)(InterruptInTearDownTests.InterruptedTestc                6    t         j                  dkD  rt        y rH   )rW   r3   r"   r   s    r   tearDownz1InterruptInTearDownTests.InterruptedTest.tearDown]   s    '0014'' 5r   c                6    t         xj                  dz  c_        y rJ   )rW   r3   r   s    r   rL   z0InterruptInTearDownTests.InterruptedTest.test_01a   s    $--2-r   c                L    t         xj                  dz  c_        dt         _        y rN   )rW   r3   rD   r   s    r   rO   z0InterruptInTearDownTests.InterruptedTest.test_02d   s    $--2-37$0r   Nr   )r   r   r   r[   rL   rO   r   r   r   r(   rY   \   s    	(	3	8r   r(   c                    t         |           | j                  j                  t        j
                        | _        dt        _        dt        _        y )Nr   F)	r*   r   r   r+   rW   r(   r,   r3   rD   r-   s    r   r   zInterruptInTearDownTests.setUph   s;    [[**+C+S+ST
,- )/4 ,r   c                .   | j                  dt        j                         | j                  d| j                  j	                                | j                  d| j
                  j                         | j                  | j
                  j                         y rR   )r1   rW   r3   r,   r2   r   r4   r5   r   s    r   r6   z%InterruptInTearDownTests.test_setUpOKn   sh    4==>DJJ5578DMM223112r   c                L   t        j                  | j                  g      j                  | j                         | j                  d| j                  j                         | j                  | j                  j                         | j                  t        j                  d       y )NrK   rT   )r   r9   r,   r:   r   r1   r3   r;   r5   r4   rW   rD   r   s    r   test_interruptInTearDownz1InterruptInTearDownTests.test_interruptInTearDownt   sl    4::,'++DMM:DMM2230011==}Mr   r   )r   r   r   r3   r=   r   r>   r(   r   r6   ra   r?   r@   s   @r   rW   rW   X   s0    H
8(++ 
853Nr   rW   N)__doc__
__future__r   ior   twisted.trialr   r   r   SynchronousTestCaser	   r   rB   rW   r   r   r   <module>rg      sT    #  4 4*,, *
9 
@ KI  KF Ny  Nr   