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.7/test/test_json/__pycache__/test_decode.cpython-37.opt-1.pyc
B

��g{�@sfddlZddlmZddlmZddlmZmZGdd�d�ZGdd�dee�Z	Gd	d
�d
ee�Z
dS)�N)�StringIO)�OrderedDict)�PyTest�CTestc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
TestDecodecCs8|jdtjd�}|�t|tj��|�|t�d��dS)Nz1.1)Zparse_float)�loads�decimalZDecimal�
assertTrue�
isinstance�assertEqual)�self�rval�r�6/usr/local/lib/python3.7/test/test_json/test_decode.py�test_decimalszTestDecode.test_decimalcCs.|jdtd�}|�t|t��|�|d�dS)N�1)Z	parse_intg�?)r�floatr	r
r)rr
rrr�
test_float
szTestDecode.test_floatcCs:|�|�d�i�|�|�d�g�|�|�d�d�dS)Nz{}z[]z""�)rr)rrrr�test_empty_objectsszTestDecode.test_empty_objectscCs�d}dddddddg}|�|�|�t|��|�|j|d	d
�d�|�|�|jjt|�dd
�d�|�|j|td�}|�|t|��|�t|�t�|�|j|td
d
�d�t|��|�|jdtd�t��|�|jdtd�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�cSs|S)Nr)�xrrr�<lambda>�z3TestDecode.test_object_pairs_hook.<locals>.<lambda>)�object_pairs_hookcSs|S)Nr)rrrrrrcSsdS)Nr)rrrrr$r)r Zobject_hookz{}z
{"empty": {}}�empty)rr�eval�json�loadrr�type)r�s�pZodrrr�test_object_pairs_hooks$



z!TestDecode.test_object_pairs_hookcCs |�d�}|�|ddd��dS)Nz,{   "key"    :    "value"    ,  "k":"v"    }�value�v)�key�k)rr)r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_reuse4s"zTestDecode.check_keys_reusecCs<d}|�||j�|jj��}|�||j�|�|j�dS)Nu2[{"a_key": 1, "b_é": 2}, {"a_key": 3, "b_é": 4}])r4rr#�decoder�JSONDecoder�decodeZassertFalseZmemo)rr&r5rrr�test_keys_reuse:s
zTestDecode.test_keys_reusecCs d}d}|�|j||j|�dS)Nz
[1, 2, 3]5z
Extra data)�assertRaisesRegex�JSONDecodeErrorr)rr&�msgrrr�test_extra_dataAszTestDecode.test_extra_datacCs d}d}|�|j||j|�dS)Nz	["abc\y"]�escape)r9r:r)rr&r;rrr�test_invalid_escapeFszTestDecode.test_invalid_escapecCs2d}x(ddgidgD]}|�t||j|�qWdS)Nzthe JSON object must be strrg��Q�	@)r9�	TypeErrorr)rr;r)rrr�test_invalid_input_typeKsz"TestDecode.test_invalid_input_typec	Cs�d�d��d�}|�|j��}|�|�WdQRX|�dt|j��|�|j��}|j�	t
|��WdQRX|�dt|j��d�d�d��d��}|�|�|�d�|�|j�	t
|��d�dS)Nz[1,2,3]z	utf-8-sigzutf-8�BOMz"{}"ru)
�encoder7�assertRaisesr:rZassertIn�strZ	exceptionr#r$r�formatr)rZbom_json�cmZ
bom_in_strrrr�test_string_with_utf8_bomPsz$TestDecode.test_string_with_utf8_bomcCs |j��}|�t|jdd�dS)NZ*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaai�<��)r#r6rC�
ValueErrorZ
raw_decode)rr3rrr�test_negative_index^s
zTestDecode.test_negative_indexN)�__name__�
__module__�__qualname__rrrr(r-r4r8r<r>r@rGrIrrrrrsrc@seZdZdS)�TestPyDecodeN)rJrKrLrrrrrMbsrMc@seZdZdS)�TestCDecodeN)rJrKrLrrrrrNcsrN)r�ior�collectionsrZtest.test_jsonrrrrMrNrrrr�<module>s[