HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/test_json/__pycache__/test_tool.cpython-38.pyc
U

0D�g^�@sfddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZGdd�dej�Z
dS)�N)�Popen�PIPE)�support)�assert_python_okc@s�eZdZdZe�d�Ze�d�Ze�d�Ze�d�Z	dd�Z
dd	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Ze�ejdkd�dd��ZdS)�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"
        }
    ]
    zr    {"ingredients":["frog", "water", "chocolate", "glucose"]}
    {"ingredients":["chocolate","steel bolts"]}
    z�    {
        "ingredients": [
            "frog",
            "water",
            "chocolate",
            "glucose"
        ]
    }
    {
        "ingredients": [
            "chocolate",
            "steel bolts"
        ]
    }
    c	Csftjddf}t|tttd��}|�|j���\}}W5QRX|�|��|j	�����|�|d�dS)N�-m�	json.tool��stdin�stdout�stderr�)
�sys�
executablerr�communicate�data�encode�assertEqual�
splitlines�expect��self�args�proc�out�err�r�7/opt/cppython/lib/python3.8/test/test_json/test_tool.py�test_stdin_stdoutWs
zTestTool.test_stdin_stdoutNc	CsBtj}t|ddd��$}|�tj|�|�|p0|j�W5QRX|S)N�wzutf-8)�encoding)r�TESTFN�open�
addCleanup�os�remove�writer)rr�infile�fprrr�_create_infile^s
zTestTool._create_infilecCsP|��}tdd|�\}}}|�|d�|�|��|j�����|�|d�dS)Nrrrr
)r)rrrrr�rr'�rcrrrrr�test_infile_stdoutes
zTestTool.test_infile_stdoutcCs^d}t�d���}|�|�}tdd|�\}}}|�|d�|�|��|���|�|d�dS)Nu{"msg": "こんにちは"}zP        {
            "msg": "\u3053\u3093\u306b\u3061\u306f"
        }
        rrrr
)�textwrap�dedentrr)rrr)rrrr'r+rrrrr�test_non_ascii_infilels
zTestTool.test_non_ascii_infilec	Cs�|��}tjd}tdd||�\}}}|�tj|�t|d��}|�|�	�|j
�W5QRX|�|d�|�|d�|�|d�dS)Nz.outrr�rrr
)r)rr!rr#r$r%r"r�readr)rr'Zoutfiler+rrr(rrr�test_infile_outfile{s
zTestTool.test_infile_outfilec	Cshtjdddf}t|tttd��}|�|j���\}}W5QRX|�|��|j	�����|�|d�dS)Nrrz--json-linesr	r
)
rrrrr�
jsonlines_rawrrr�jsonlines_expectrrrr�test_jsonlines�s
zTestTool.test_jsonlinescCs>tddd�\}}}|�|d�|�|�d��|�|d�dS)Nrrz-hrsusage: r
)rrZ
assertTrue�
startswith)rr+rrrrr�test_help_flag�szTestTool.test_help_flagcCsR|��}tddd|�\}}}|�|d�|�|��|j�����|�|d�dS)Nrrz--sort-keysrr
)r)rrr�expect_without_sort_keysrr*rrr�test_sort_keys_flag�s
�zTestTool.test_sort_keys_flag�win32z-The test is failed with ValueError on WindowscCsBtjddg}t|ttd�}|j��|�d�|�|jt	j
�dS)Nrr)rr
s"{}")rrrrr�closerr�
returncode�errno�EPIPE)r�cmdrrrr�test_broken_pipe_error�s


zTestTool.test_broken_pipe_error)N)�__name__�
__module__�__qualname__rr-r.r8rr3r4rr)r,r/r2r5r7r9�unittestZskipIfr�platformr@rrrrrs




r)r=r$rr-rD�
subprocessrr�testrZtest.support.script_helperrZTestCaserrrrr�<module>s