HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_json/__pycache__/test_decode.cpython-310.pyc
o

�i��@srddlZddlmZddlmZddlmZmZddlm	Z	Gdd�d�Z
Gdd	�d	e
e�ZGd
d�de
e�ZdS)�N)�StringIO)�OrderedDict)�PyTest�CTest)�supportc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
TestDecodecCs8|jdtjd�}|�t|tj��|�|t�d��dS)Nz1.1)Zparse_float)�loads�decimalZDecimal�
assertTrue�
isinstance�assertEqual��self�rval�r�7/usr/local/lib/python3.10/test/test_json/test_decode.py�test_decimal	szTestDecode.test_decimalcCs.|jdtd�}|�t|t��|�|d�dS)N�1)Z	parse_intg�?)r�floatr
rrr
rrr�
test_floatszTestDecode.test_floatcCs:|�|�d�i�|�|�d�g�|�|�d�d�dS)N�{}z[]z""�)rr)rrrr�test_empty_objectsszTestDecode.test_empty_objectscCs�d}gd�}|�|�|�t|��|�|j|dd�d�|�|�|jjt|�dd�d�|�|j|td�}|�|t|��|�t|�t�|�|j|tdd�d�t|��|�|jd	td�t��|�|jd
td�tdt�fg��dS)Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}))Zxkd�)Zkcw�)Zart�)Zhxm�)Zqrt�)Zpad�)Zhoy�cS�|S�Nr��xrrr�<lambda>�z3TestDecode.test_object_pairs_hook.<locals>.<lambda>)�object_pairs_hookcSr r!rr"rrrr$r%cSsdSr!rr"rrrr$%r%)r&Zobject_hookrz
{"empty": {}}�empty)rr�eval�json�loadrr�type)r�s�pZodrrr�test_object_pairs_hooks2�����
��z!TestDecode.test_object_pairs_hookcCs |�d�}|�|ddd��dS)Nz,{   "key"    :    "value"    ,  "k":"v"    }�value�v)�key�k)rrr
rrr�test_decoder_optimizations.s
z%TestDecode.test_decoder_optimizationscCsF||�}t|d�t|d�\}}\}}|�||�|�||�dS)Nrr)�sortedZassertIs)r�sourcerr�a�b�c�drrr�check_keys_reuse5s"zTestDecode.check_keys_reusecCs<d}|�||j�|jj��}|�||j�|�|j�dS)Nu2[{"a_key": 1, "b_é": 2}, {"a_key": 3, "b_é": 4}])r:rr)�decoder�JSONDecoder�decodeZassertFalse�memo)rr,r;rrr�test_keys_reuse;s
zTestDecode.test_keys_reusecC� d}d}|�|j||j|�dS)Nz
[1, 2, 3]5z
Extra data��assertRaisesRegex�JSONDecodeErrorr�rr,�msgrrr�test_extra_dataB�zTestDecode.test_extra_datacCr@)Nz	["abc\y"]�escaperArDrrr�test_invalid_escapeGrGzTestDecode.test_invalid_escapecCs.d}ddgidfD]}|�t||j|�q	dS)Nzthe JSON object must be strrg��Q�	@)rB�	TypeErrorr)rrEr/rrr�test_invalid_input_typeLs�z"TestDecode.test_invalid_input_typecCs�d�d��d�}|�|j��
}|�|�Wd�n1swY|�dt|j��|�|j��}|j�	t
|��Wd�n1sEwY|�dt|j��d�d�d��d��}|�|�|�d�|�|j�	t
|��d�dS)Nz[1,2,3]z	utf-8-sigzutf-8�BOMz"{}"ru)
�encoder=�assertRaisesrCrZassertIn�str�	exceptionr)r*r�formatr)rZbom_json�cmZ
bom_in_strrrr�test_string_with_utf8_bomQs��z$TestDecode.test_string_with_utf8_bomcCs |j��}|�t|jdd�dS)NZ*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaai�<��)r)r<rN�
ValueErrorZ
raw_decode)rr9rrr�test_negative_index_s
zTestDecode.test_negative_indexc	Cs�d}t�|��6|�d|�|�t��|�d|d�Wd�n1s(wYWd�dSWd�dS1s@wYdS)Ni�rr)rZadjust_int_max_str_digitsrrNrT)rZ	maxdigitsrrr�test_limit_intcs��"�zTestDecode.test_limit_intN)�__name__�
__module__�__qualname__rrrr.r3r:r?rFrIrKrSrUrVrrrrrsrc@�eZdZdS)�TestPyDecodeN�rWrXrYrrrrr[k�r[c@rZ)�TestCDecodeNr\rrrrr^lr]r^)
r	�ior�collectionsrZtest.test_jsonrr�testrrr[r^rrrr�<module>sc