HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/application/runner/test/__pycache__/test_exit.cpython-310.pyc
o

�b��@sldZddlmZddlmZmZddlZddlm	Z	ddl	m
Z
mZGd	d
�d
ejj
j�ZGdd�d�ZdS)
z0
Tests for L{twisted.application.runner._exit}.
�)�StringIO)�Optional�UnionN�)�_exit�)�
ExitStatus�exitc@sBeZdZdZddd�Zddd�Zddd	�Zdd
d�Zddd
�ZdS)�	ExitTestsz
    Tests for L{exit}.
    �returnNcCst�|_|�td|j�dS)N�sysexit)�	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}.
        i�N)r	�assertEqual�arg�r�statusrrr�test_exitStatusIntszExitTests.test_exitStatusIntcCs$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_CONFIGr	rr�valuerrrr�test_exitConstant!szExitTests.test_exitConstantcC�: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�rrrr	r�getvalue�r�out�messagerrr�test_exitMessageZero*�

zExitTests.test_exitMessageZerocCr)zj
        L{exit} given a non-zero status code writes the given message to
        standard error.
        �stderrr�@rNr r"rrr�test_exitMessageNonZero7r&z!ExitTests.test_exitMessageNonZero�rN)	�__name__�
__module__�__qualname__�__doc__rrrr%r)rrrrr
s



	
r
c@s:eZdZdZd	dd�Zd
deeeefddfdd�Z	dS)r
zv
    Stub for L{sys.exit} that remembers whether it's been called and, if it
    has, what argument it was given.
    rNcCs
d|_dS)NF)�exitedrrrr�__init__Ks
zDummyExit.__init__rcCs|jrJ�||_d|_dS)NT)r/r)rrrrr�__call__Ns

zDummyExit.__call__r*)N)
r+r,r-r.r0rr�int�strr1rrrrr
Es
$r
)r.�ior�typingrr�twisted.trial.unittest�twisted�runnerrrr	�trial�unittest�TestCaser
r
rrrr�<module>s5