Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/test_json/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/test_json/__pycache__/test_tool.cpython-35.opt-2.pyc



���]��@syddlZddlZddlZddlZddlZddlmZddlmZGdd�dej	�Z
dS)�N)�support)�assert_python_okc@s|eZdZdZejd�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
Cs�tjtjddfdtjdtj��%}|j|jj��\}}WdQRX|j|j	�|j
j�j	��|j|d�dS)Nz-mz	json.tool�stdin�stdout)�
subprocess�Popen�sys�
executable�PIPE�communicate�data�encode�assertEqual�
splitlines�expect)�self�proc�out�err�r�./opt/alt/python35/lib64/python3.5/test_tool.py�test_stdin_stdout?s%%zTestTool.test_stdin_stdoutc
CsItj}t|d��*}|jtj|�|j|j�WdQRX|S)N�w)r�TESTFN�open�
addCleanup�os�remove�writer
)r�infile�fprrr�_create_infileGs
	zTestTool._create_infilecCsp|j�}tdd|�\}}}|j|d�|j|j�|jj�j��|j|d�dS)Nz-mz	json.toolr�)r"rrrrr)rr �rcrrrrr�test_infile_stdoutNs
%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_outfileUs
 zTestTool.test_infile_outfilecCsUtddd�\}}}|j|d�|j|jd��|j|d�dS)Nz-mz	json.toolz-hrsusage: r#)rrZ
assertTrue�
startswith)rr$rrrrr�test_help_flag`szTestTool.test_help_flagcCss|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_flagfszTestTool.test_sort_keys_flagN)�__name__�
__module__�__qualname__r
�textwrap�dedentr+rrr"r%r(r*r,rrrrr
s		r)rr	r0ZunittestrZtestrZtest.support.script_helperrZTestCaserrrrr�<module>s