Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/test/test_json/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/test/test_json/__pycache__/test_tool.cpython-36.opt-1.pyc

3

� fz�@s^ddlZddlZddlZddlZddlmZmZddlmZddl	m
Z
Gdd�dej�ZdS)�N)�Popen�PIPE)�support)�assert_python_okc@sTeZdZdZejd�Zejd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�TestToolz�

        [["blorpie"],[ "whoops" ] , [
                                 ],	"d-shtaeou",
"d-nthiouh",
        "i-vhbjkhnth", {"nifty":87}, {"morefield" :	false,"field"
            :"yes"}  ]
           a.    [
        [
            "blorpie"
        ],
        [
            "whoops"
        ],
        [],
        "d-shtaeou",
        "d-nthiouh",
        "i-vhbjkhnth",
        {
            "nifty": 87
        },
        {
            "field": "yes",
            "morefield": false
        }
    ]
    a.    [
        [
            "blorpie"
        ],
        [
            "whoops"
        ],
        [],
        "d-shtaeou",
        "d-nthiouh",
        "i-vhbjkhnth",
        {
            "nifty": 87
        },
        {
            "morefield": false,
            "field": "yes"
        }
    ]
    c
Csftjddf}t|tttd��}|j|jj��\}}WdQRX|j|j�|j	j�j��|j|d�dS)Nz-mz	json.tool)�stdin�stdout�stderr�)
�sys�
executablerrZcommunicate�data�encode�assertEqual�
splitlines�expect)�self�args�proc�out�err�r�=/opt/alt/python36/lib64/python3.6/test/test_json/test_tool.py�test_stdin_stdout?s
zTestTool.test_stdin_stdoutc
Cs:tj}t|d�� }|jtj|�|j|j�WdQRX|S)N�w)r�TESTFN�open�
addCleanup�os�remove�writer
)r�infile�fprrr�_create_infileFs
zTestTool._create_infilecCsP|j�}tdd|�\}}}|j|d�|j|j�|jj�j��|j|d�dS)Nz-mz	json.toolrr
)r#rrrrr)rr!�rcrrrrr�test_infile_stdoutMs
zTestTool.test_infile_stdoutc
Cs�|j�}tjd}tdd||�\}}}|jtj|�t|d��}|j|j	�|j
�WdQRX|j|d�|j|d�|j|d�dS)Nz.outz-mz	json.tool�rrr
)r#rrrrrrrr�readr)rr!Zoutfiler$rrr"rrr�test_infile_outfileTs
zTestTool.test_infile_outfilecCs>tddd�\}}}|j|d�|j|jd��|j|d�dS)Nz-mz	json.toolz-hrsusage: r
)rrZ
assertTrue�
startswith)rr$rrrrr�test_help_flag_szTestTool.test_help_flagcCsR|j�}tddd|�\}}}|j|d�|j|j�|jj�j��|j|d�dS)Nz-mz	json.toolz--sort-keysrr
)r#rrr�expect_without_sort_keysr)rr!r$rrrrr�test_sort_keys_flages
zTestTool.test_sort_keys_flagN)�__name__�
__module__�__qualname__r
�textwrap�dedentr+rrr#r%r(r*r,rrrrr
sr)
rrr0Zunittest�
subprocessrrZtestrZtest.support.script_helperrZTestCaserrrrr�<module>s