Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_getopt.cpython-38.opt-2.pyc
U

>��g��@sPddlmZmZmZddlZddlZe�ZGdd�dej�Z	e
dkrLe��dS)�)�verbose�run_doctest�EnvironmentVarGuardNc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�GetoptTestscCst�|_d|jkr|jd=dS)N�POSIXLY_CORRECT)r�env��self�r
�//opt/cppython/lib/python3.8/test/test_getopt.py�setUps
zGetoptTests.setUpcCs|j��|`dS�N)r�__exit__rr
r
r�tearDowns
zGetoptTests.tearDowncOs|jtjf|�|�dSr
)�assertRaises�getopt�GetoptError)r	�args�kwargsr
r
r�assertErrorszGetoptTests.assertErrorcCs8|�t�dd��|�t�dd��|�tjdd�dS)N�a�a:�b)�
assertTruerZ
short_has_arg�assertFalserrr
r
r�test_short_has_argszGetoptTests.test_short_has_argcCs�t�ddg�\}}|�|�|�|d�t�ddg�\}}|�|�|�|d�t�ddg�\}}|�|�|�|d�|�tjddg�|�tjdg�|�tjdddg�dS)N�abc�abc=�abcd�defZabcde)rZ
long_has_argsr�assertEqualrr)r	Zhas_arg�optionr
r
r�test_long_has_argss


zGetoptTests.test_long_has_argscCs�t�gddg�\}}|�|dg�|�|g�t�gddg�\}}|�|dg�|�|g�t�gdddg�\}}|�|dg�|�|g�t�gddddg�\}}|�|dg�|�|dg�|�tjgddg�|�tjgddg�dS)Nr��-a�Za1r�r$�1r'�2)rZ	do_shortsr r�r	�optsrr
r
r�test_do_shorts.szGetoptTests.test_do_shortscCs&t�gddgg�\}}|�|dg�|�|g�t�gddgg�\}}|�|dg�|�|g�t�gddgg�\}}|�|dg�|�|g�t�gdddd	gg�\}}|�|dg�|�|g�t�gd
ddgg�\}}|�|d
g�|�|g�|�tjgddgg�|�tjgddgg�dS)Nr)�--abcr%zabc=1r)r,r'zabcd=)z--abcdr'�abrzfoo=42zfoo-barzfoo=)z--fooZ42)rZdo_longsr rr)r
r
r�
test_do_longsFs"zGetoptTests.test_do_longscCsvdddddddddddd	g}t�|d
ddg�\}}|�|d
ddddddg�|�|dd	g�|�tj|d
ddg�dS)Nr$r'�-bz	--alpha=2�--beta�3r%�arg1Zarg2za:bzalpha=�betar&)r/r%)�--alphar()r0r%)r$r1r#�alpha)rr r�r	Zcmdliner*rr
r
r�test_getoptas �
�zGetoptTests.test_getoptcCsddddddg}t�|ddd	g�\}}|�|dg�|�|d
ddd
g�t�ddddgdg�\}}|�|dg�|�|d
dg�t�|ddd	g�\}}|�|d
g�|�|dddddg�d|jd<t�|ddd	g�\}}|�|d
g�|�|dddddg�dS)Nr$r2r/r'r4z--beta=2zab:r5zbeta=r#)r/r')r4r%)r0r(�-)r/r8z+ab:r)rZ
gnu_getoptr rr6r
r
r�test_gnu_getoptrs"
�
zGetoptTests.test_gnu_getoptcCs&d}ddl}|�d|�}t|t�dS)Na�
        Examples from the Library Reference:  Doc/lib/libgetopt.tex

        An example using only Unix style options:


        >>> import getopt
        >>> args = '-a -b -cfoo -d bar a1 a2'.split()
        >>> args
        ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'abc:d:')
        >>> optlist
        [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]
        >>> args
        ['a1', 'a2']

        Using long option names is equally easy:


        >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
        >>> args = s.split()
        >>> args
        ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'x', [
        ...     'condition=', 'output-file=', 'testing'])
        >>> optlist
        [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]
        >>> args
        ['a1', 'a2']
        rZ
libreftest)�types�
ModuleTyperr)r	�sr:�mr
r
r�test_libref_examples�sz GetoptTests.test_libref_examplescCsft�dgddg�\}}|�|dg�t�dgddg�\}}|�|dg�|�tjtjdgddg�dS)Nz--help=r%zhelp=)�--helpr%z--help=x)r?�x�help)rr rr)r	ZlongoptsZ	shortoptsr
r
r�test_issue4629�s
zGetoptTests.test_issue4629N)�__name__�
__module__�__qualname__rrrrr"r+r.r7r9r>rBr
r
r
rrs$r�__main__)Ztest.supportrrrZunittestr�object�sentinelZTestCaserrC�mainr
r
r
r�<module>s-

F1le Man4ger