Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_json/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_json/__pycache__/test_tool.cpython-312.opt-2.pyc

�

)Μg|���ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZej�Gd�dej��Zy)�N)�support)�	os_helper)�assert_python_okc�H�eZdZdZej
d�Zej
d�Zej
d�Zej
d�Z	d�Z
dd�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zej4ej8dk(d�d��Zy)�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��tjddf}tj||jddd��}|j|j|j�|j|jd�y)N�-m�	json.toolT��input�capture_output�text�check�)	�sys�
executable�
subprocess�run�data�assertEqual�stdout�expect�stderr��self�args�processs   �5/usr/local/lib/python3.12/test/test_json/test_tool.py�test_stdin_stdoutzTestTool.test_stdin_stdoutYsZ���~�~�t�[�0���.�.��T�Y�Y�t�RV�^b�c�����������5��������,�Nc���tj}t|dd��5}|jtj
|�|j
|xs|j�ddd�|S#1swY|SxYw)N�w�utf-8��encoding)r�TESTFN�open�
addCleanup�os�remove�writer)rr�infile�fps    r�_create_infilezTestTool._create_infile_s[���!�!��
�&�#��
0�B��O�O�B�I�I�v�.��H�H�T�&�T�Y�Y�'�1��
�1��
�s�AA)�)A3c��|j�}tdd|�\}}}|j|d�|j|j�|jj�j��|j|d�y)Nr	r
rr )r.rr�
splitlinesr�encode�rr,�rc�out�errs     r�test_infile_stdoutzTestTool.test_infile_stdoutfsq���$�$�&��'��k�6�B���C������Q��������)�4�;�;�+=�+=�+?�+J�+J�+L�M�����c�"r c�6�d}tjd�j�}|j|�}t	dd|�\}}}|j|d�|j|j
�|j
��|j|d�y)Nu{"msg": "こんにちは"}zP        {
            "msg": "\u3053\u3093\u306b\u3061\u306f"
        }
        r	r
rr )�textwrap�dedentr1r.rrr0)rrrr,r3r4r5s       r�test_non_ascii_infilezTestTool.test_non_ascii_infilems���:�����"�
��V�X�		��$�$�T�*��'��k�6�B���C������Q��������)�6�+<�+<�+>�?�����c�"r c��|j�}tjdz}tdd||�\}}}|j	t
j|�t|dd��5}|j|j�|j�ddd�|j|d�|j|d�|j|d�y#1swY�@xYw)	N�.outr	r
�rr#r$rr )r.rr&rr(r)r*r'r�readr)rr,�outfiler3r4r5r-s       r�test_infile_outfilezTestTool.test_infile_outfile|s����$�$�&���"�"�V�+��'��k�6�7�K���C������	�	�7�+�
�'�3��
1�R����R�W�W�Y����4�2�����Q������c�"�����c�"�	2�
1�s�$+C�Cc�N�|j�}tdd||�\}}}t|dd��5}|j|j	�|j
�ddd�|j|d�|j|d�|j|d�y#1swY�@xYw)Nr	r
r=r#r$rr )r.rr'rr>r)rr,r3r4r5r-s      r�test_writing_in_placezTestTool.test_writing_in_place�s����$�$�&��'��k�6�6�J���C��
�&�#��
0�B����R�W�W�Y����4�1�����Q������c�"�����c�"�	1�
0�s�+B�B$c��tjdddf}tj||jddd��}|j|j|j�|j|jd�y)Nr	r
z--json-linesTrr)	rrrr�
jsonlines_rawrr�jsonlines_expectrrs   r�test_jsonlineszTestTool.test_jsonlines�sa���~�~�t�[�.�@���.�.��T�-?�-?�PT�[_�gk�l���������)>�)>�?��������,r c��tddd�\}}}|j|d�|j|jd��|j|d�y)Nr	r
z-hrsusage: r )rr�
assertTrue�
startswith)rr3r4r5s    r�test_help_flagzTestTool.test_help_flag�sK��'��k�4�@���C������Q��������z�2�3�����c�"r c��|j�}tddd|�\}}}|j|d�|j|j�|jj�j��|j|d�y)Nr	r
z--sort-keysrr )r.rrr0�expect_without_sort_keysr1r2s     r�test_sort_keys_flagzTestTool.test_sort_keys_flag�sy���$�$�&��'��k�=�&�Q���C������Q��������)��6�6�=�=�?�J�J�L�	N�����c�"r c��d}tjd�}tjddddf}t	j
||ddd��}|j
|j|�|j
|jd	�y)
N�[1, 2]z5        [
          1,
          2
        ]
        r	r
z--indent�2Trr)	r8r9rrrrrrr�r�input_rrrs     r�test_indentzTestTool.test_indent�so�������"�
���~�~�t�[�*�c�A���.�.��V�D�t�[_�`���������0��������,r c���d}d}tjdddf}tj||ddd��}|j	|j
|�|j	|jd�y)	Nz[1,
2]z[1, 2]
r	r
z--no-indentTrr�rrrrrrrrQs     r�test_no_indentzTestTool.test_no_indent�s]�������~�~�t�[�-�?���.�.��V�D�t�[_�`���������0��������,r c���d}d}tjdddf}tj||ddd��}|j	|j
|�|j	|jd�y)	NrOz[
	1,
	2
]
r	r
z--tabTrrrUrQs     r�test_tabzTestTool.test_tab�s]����$���~�~�t�[�'�9���.�.��V�D�t�[_�`���������0��������,r c���d}d}tjdddf}tj||ddd��}|j	|j
|�|j	|jd�y)	Nz	[ 1 ,
 2]z[1,2]
r	r
z	--compactTrrrUrQs     r�test_compactzTestTool.test_compact�s]�������~�~�t�[�+�=���.�.��V�D�t�[_�`���������0��������,r c�T�|jd�}tjdz}|jtj
|�t
ddd||�t|d�5}|j�j�}ddd�gd�}|j|�y#1swY� xYw)N�{"key":"💩"}r<r	r
z--no-ensure-ascii�rb)�{s    "key": "💩"�}�r.rr&r(r)r*rr'r>r0r�rr,r?�f�lines�expecteds      r�test_no_ensure_ascii_flagz"TestTool.test_no_ensure_ascii_flag�s����$�$�%5�6���"�"�V�+������	�	�7�+���{�,?���Q�
�'�4�
 �A��F�F�H�'�'�)�E�!�B�������)�	!�
 �s� B�B'c�R�|jd�}tjdz}|jtj
|�t
dd||�t|d�5}|j�j�}ddd�gd�}|j|�y#1swY� xYw)Nr\r<r	r
r])r^s    "key": "\ud83d\udca9"r_r`ras      r�test_ensure_ascii_defaultz"TestTool.test_ensure_ascii_default�s����$�$�%5�6���"�"�V�+������	�	�7�+���{�F�G�<�
�'�4�
 �A��F�F�H�'�'�)�E�!�?�������)�	!�
 �s�B�B&�win32z-The test is failed with ValueError on Windowsc�<�tjddg}tj|tjtj��}|j
j
�|jd�|j|jtj�y)Nr	r
)r�stdins"{}")rrr�Popen�PIPEr�close�communicater�
returncode�errno�EPIPE)r�cmd�procs   r�test_broken_pipe_errorzTestTool.test_broken_pipe_error�sj���~�~�t�[�1������'1���&0�o�o�7��	
����������!�������%�+�+�6r )N)�__name__�
__module__�__qualname__rr8r9rLrrDrErr.r6r:r@rBrFrJrMrSrVrXrZrerg�unittest�skipIfr�platformrt�r rrr
s����D� /�x���0� 	��,�X�_�_��	�F�,$�H�O�O�%�	�M�
'�x���(�	��"-��#�
#�	#�#�-�#�#�-�-�-�-�	*�	*��X�_�_�S�\�\�G�+�-\�]�7�^�7r r)rpr)rr8rxr�testr�test.supportr�test.support.script_helperr�requires_subprocess�TestCaserr{r r�<module>r�sO���	�
�����"�7������Z7�x� � �Z7��Z7r 

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists