Your IP : 216.73.217.32


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_getopt.cpython-39.pyc

a

XC?h��@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|jvr|jd=dS)N�POSIXLY_CORRECT)r�env��self�r
�5/opt/alt/python39/lib64/python3.9/test/test_getopt.py�setUps
zGetoptTests.setUpcCs|j��|`dS�N)r�__exit__rr
r
r�tearDowns
zGetoptTests.tearDowncOs|jtjg|�Ri|��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_argZoptionr
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�gdgd�g�\}}|�|dg�|�|g�t�gd	d
dgg�\}}|�|dg�|�|g�|�tjgddgg�|�tjgddgg�dS)
Nr)�--abcr$zabc=1r)r+r&zabcd=)z--abcdr&)Zabrrzfoo=42zfoo-barzfoo=)z--fooZ42)rZdo_longsr rr(r
r
r�
test_do_longsFs"zGetoptTests.test_do_longscCsXgd�}t�|dddg�\}}|�|gd��|�|ddg�|�tj|dddg�dS)	N)r#r&�-bz	--alpha=2�--betar#�3r#r$r.�arg1�arg2za:bzalpha=Zbeta)r%)r-r$)�--alphar'�r.r$)r#r/r"r3r0r1�alpha)rr r�r	Zcmdliner)rr
r
r�test_getoptas
zGetoptTests.test_getoptcCs�gd�}t�|dddg�\}}|�|dg�|�|gd��t�gd�dg�\}}|�|dg�|�|d	d
g�t�|dddg�\}}|�|d	g�|�|gd��d
|jd<t�|dddg�\}}|�|d	g�|�|gd��dS)N)r#r0r-r&r2�--beta=2zab:r4zbeta=r0)r")r-r&)r2r$)r.r')r#�-r-r8r8r")r-r8z+ab:)r0r-r&r2r7r&r)rZ
gnu_getoptr rr5r
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,r6r9r>rBr
r
r
rrs$r�__main__)Ztest.supportrrrZunittestr�object�sentinelZTestCaserrC�mainr
r
r
r�<module>s-