HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/application/runner/test/__pycache__/test_exit.cpython-38.pyc
U


W[�	�@s^dZddlmZddlmZddlmZmZddlZGdd	�d	ej	j
j�ZGd
d�de
�ZdS)z0
Tests for L{twisted.application.runner._exit}.
�)�NativeStringIO�)�_exit�)�exit�
ExitStatusNc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�	ExitTestsz
    Tests for L{exit}.
    cCst�|_|�td|j�dS)NZsysexit)�	DummyExitr�patchr��self�r
�K/usr/lib/python3/dist-packages/twisted/application/runner/test/test_exit.py�setUpszExitTests.setUpcCs d}t|�|�|jj|�dS)zR
        L{exit} given an L{int} status code will pass it to L{sys.exit}.
        ��N�r�assertEqual�arg�rZstatusr
r
r�test_exitStatusIntszExitTests.test_exitStatusIntcCs|�ttd�dS)zn
        L{exit} given a L{str} status code that isn't a string integer raises
        L{ValueError}.
        ZfooN)ZassertRaises�
ValueErrorrrr
r
r�test_exitStatusStringNotInt#sz%ExitTests.test_exitStatusStringNotIntcCstd�|�|jjd�dS)z�
        L{exit} given a L{str} status code that is a string integer passes the
        corresponding L{int} to L{sys.exit}.
        Z1234rNrrr
r
r�test_exitStatusStringInt+sz"ExitTests.test_exitStatusStringIntcCs$tj}t|�|�|jj|j�dS)zu
        L{exit} given a L{ValueConstant} status code passes the corresponding
        value to L{sys.exit}.
        N)r�	EX_CONFIGrrr�valuerr
r
r�test_exitConstant4szExitTests.test_exitConstantcCs:t�}|�td|�d}td|�|�|��|d�dS)zq
        L{exit} given a status code of zero (C{0}) writes the given message to
        standard output.
        �stdout�
Hello, world.r�
N�rr
rrr�getvalue�r�out�messager
r
r�test_exitMessageZero>s

zExitTests.test_exitMessageZerocCs:t�}|�td|�d}td|�|�|��|d�dS)zj
        L{exit} given a non-zero status code writes the given message to
        standard error.
        �stderrr�@rNrr!r
r
r�test_exitMessageNonZeroLs

z!ExitTests.test_exitMessageNonZeroN)�__name__�
__module__�__qualname__�__doc__rrrrrr$r'r
r
r
rrs		
rc@s"eZdZdZdd�Zddd�ZdS)r	zv
    Stub for L{sys.exit} that remembers whether it's been called and, if it
    has, what argument it was given.
    cCs
d|_dS)NF)�exitedrr
r
r�__init__`szDummyExit.__init__NcCs|jr
t�||_d|_dS)NT)r,�AssertionErrorr)rrr
r
r�__call__ds
zDummyExit.__call__)N)r(r)r*r+r-r/r
r
r
rr	[sr	)r+Ztwisted.python.compatrZrunnerrrrZtwisted.trial.unittestZtwistedZtrialZunittestZTestCaser�objectr	r
r
r
r�<module>sK