https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/simplejson/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/simplejson/tests/__pycache__/test_decode.cpython-310.pyc
o

\Փa��@slddlmZddlZddlmZddlZddlmZm	Z	m
Z
ddlmZGdd�de
�ZGdd	�d	e�Z
dS)
�)�absolute_importN)�TestCase)�StringIO�b�binary_type)�OrderedDictc@s&eZdZddd�Zdd�Zdd�ZdS)	�MisbehavingBytesSubtypeNcC�dS)Nz
bad decode�)�self�encodingr
r
�>/usr/lib/python3/dist-packages/simplejson/tests/test_decode.py�decode
�zMisbehavingBytesSubtype.decodecCr	)Nzbad __str__r
�rr
r
r
�__str__rzMisbehavingBytesSubtype.__str__cCstd�S)Nz
bad __bytes__)rrr
r
r
�	__bytes__sz!MisbehavingBytesSubtype.__bytes__�N)�__name__�
__module__�__qualname__rrrr
r
r
r
r	s
rc@s~eZdZeed�s
dd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�
TestDecode�assertIscCs|�||ud||f�dS)Nz%r is %r)�
assertTrue)r�arr
r
r
rszTestDecode.assertIscCs8tjdtjd�}|�t|tj��|�|t�d��dS)Nz1.1)�parse_float)�json�loads�decimal�Decimalr�
isinstance�assertEqual�r�rvalr
r
r
�test_decimalszTestDecode.test_decimalcCs.tjdtd�}|�t|t��|�|d�dS)N�1)�	parse_intg�?)rr�floatrr r!r"r
r
r
�
test_floatszTestDecode.test_floatcCs t�d�}|�|ddd��dS)Nz,{   "key"    :    "value"    ,  "k":"v"    }�value�v)�key�k)rrr!r"r
r
r
�test_decoder_optimizations s
z%TestDecode.test_decoder_optimizationscCsRd}|�t�|�t|��d}|�t�|�t|��d}|�t�|�t|��dS)Nz{}z[]�"")r!rr�eval�r�sr
r
r
�test_empty_objects'szTestDecode.test_empty_objectscCs�d}gd�}|�t�|�t|��|�tj|dd�d�|�|�tjt|�dd�d�|�tj|td�}|�|t|��|�t|�t�|�tj|tdd�d�t|��dS)	Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}))�xkd�)�kcw�)�art�)�hxm�)�qrt�)�pad�)�hoy�cS�|Srr
��xr
r
r
�<lambda>4�z3TestDecode.test_object_pairs_hook.<locals>.<lambda>��object_pairs_hookcSrArr
rBr
r
r
rD6rEcSsdSrr
rBr
r
r
rD=rE)rG�object_hook)r!rrr/�loadrr�type)rr1�p�odr
r
r
�test_object_pairs_hook/s$��
��z!TestDecode.test_object_pairs_hookcCsF||�}t|d�t|d�\}}\}}|�||�|�||�dS)Nrr4)�sortedr)r�sourcerr#rr�c�dr
r
r
�check_keys_reuse@s"zTestDecode.check_keys_reusecCsd�d�}|�|tj�dS)N�2[{"a_key": 1, "b_é": 2}, {"a_key": 3, "b_é": 4}]�utf8)�encoderRrrr0r
r
r
�test_keys_reuse_strFs
zTestDecode.test_keys_reuse_strcCsd}|�|tj�dS)NrS)rRrrr0r
r
r
�test_keys_reuse_unicodeJsz"TestDecode.test_keys_reuse_unicodecCsP|�t�d�d�|�t�d�d�|�t�d�dg�|�t�d�dg�dS)Nr.�z[""])r!rrrr
r
r
�test_empty_stringsNszTestDecode.test_empty_stringscCsdtjj}|�diidf|��d��|�diidf|td��d��|�diidf|��d��dS)Nr�	z	{"a": {}}rF�z 
{"a": {}})r�decoder�JSONDecoderr!�
raw_decode�dict)r�clsr
r
r
�test_raw_decodeTs

�
�

�zTestDecode.test_raw_decodecCs�tjj}td�}|�|��|�d�|�|dd��|�d�|�|dd��|�d�ttd��}|�|��|�d�|�|dd��|�d�|�|dd��|�d�dS)Nu"€"u€�latin1)ru€)rr\r]rr!rr)rr`�datar
r
r
�test_bytes_decodebszTestDecode.test_bytes_decodecCs�tj��}dD]}|�t|jd|�|�t|jd|�qtddgtd�\}}t|�t|�}|�t|j||�|�t|j||�dS)N)	r:r<r>���������������i�����1234�	128931233�	472389423)r+)	rr\r]�assertRaises�
ValueError�	scan_oncer^rN�id)r�j�irC�y�diffr
r
r
�test_bounds_checkingns
zTestDecode.test_bounds_checkingN)rrr�hasattrrrr$r(r-r2rMrRrVrWrYrardrur
r
r
r
rs
r)�
__future__rr�unittestr�
simplejsonr�simplejson.compatrrrrrrr
r
r
r
�<module>s

https://t.me/RX1948 - 2025