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_recursion.cpython-310.opt-1.pyc
o

�i
�@s`ddlmZddlmZmZGdd�d�ZGdd�d�ZGdd�dee�ZGd	d
�d
ee�ZdS)�)�support)�PyTest�CTestc@�eZdZdS)�JSONTestObjectN��__name__�
__module__�__qualname__�rr�:/usr/local/lib/python3.10/test/test_json/test_recursion.pyrsrc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TestRecursioncCs�g}|�|�z|�|�Wn	tyYnw|�d�g}|g}|�|�z|�|�Wn	ty7Ynw|�d�g}||g}|�|�dS)Nz)didn't raise ValueError on list recursionz5didn't raise ValueError on alternating list recursion)�append�dumps�
ValueError�fail��self�x�yrrr�test_listrecursion
s(
�

�
z TestRecursion.test_listrecursioncCsTi}||d<z|�|�Wn	tyYnw|�d�i}||d�}|�|�dS)N�testz)didn't raise ValueError on dict recursion)�a�b)rrrrrrr�test_dictrecursion!s�

z TestRecursion.test_dictrecursioncCsdGdd�d|jj�}|�}|�|�t�d�d|_z|�t�Wn
ty*YdSw|�d�dS)Nc@seZdZdZdd�ZdS)zATestRecursion.test_defaultrecursion.<locals>.RecursiveJSONEncoderFcSs&|tur|jr
tgSdS|jj�|�S)Nr)r�recurse�json�JSONEncoder�default�r�orrrr2s
zITestRecursion.test_defaultrecursion.<locals>.RecursiveJSONEncoder.defaultN)rr	r
rrrrrr�RecursiveJSONEncoder0sr!z"JSONTestObject"Tz,didn't raise ValueError on default recursion)rrZassertEqual�encoderrrr)rr!�encrrr�test_defaultrecursion/s
�z#TestRecursion.test_defaultrecursionc	CsZ|�t��)t���|�ddddd�Wd�n1s"wYWd�n1s1wY|�t��)t���|�ddddd�Wd�n1sXwYWd�n1sgwY|�t��2t���|�ddddd�Wd�n1s�wYWd�dSWd�dS1s�wYdS)Nz{"a":順�1�}z[1]�[�])�assertRaises�RecursionErrorr�infinite_recursion�loads)rrrr�#test_highly_nested_objects_decodingEs&
���
���
��"�z1TestRecursion.test_highly_nested_objects_decodingc	Cs�gi}}td�D]
}|gd|i}}q	|�t��!t���
|�|�Wd�n1s.wYWd�n1s=wY|�t��*t���
|�|�Wd�n1s\wYWd�dSWd�dS1stwYdS)Nr%�k)�ranger*r+rr,r)r�l�drrrr�#test_highly_nested_objects_encodingRs 

���
��"�z1TestRecursion.test_highly_nested_objects_encodingc	Cs�Gdd�d|jj�}|�t��-t���|dd��d�Wd�n1s'wYWd�dSWd�dS1s?wYdS)Nc@seZdZdd�ZdS)z@TestRecursion.test_endless_recursion.<locals>.EndlessJSONEncodercSs|gS)z?If check_circular is False, this will keep adding another list.rrrrrraszHTestRecursion.test_endless_recursion.<locals>.EndlessJSONEncoder.defaultN)rr	r
rrrrr�EndlessJSONEncoder`sr4F)Zcheck_circulary@)rrr*r+rr,r")rr4rrr�test_endless_recursion^s
��"�z$TestRecursion.test_endless_recursionN)	rr	r
rrr$r.r3r5rrrrr
	s
r
c@r)�TestPyRecursionNrrrrrr6j�r6c@r)�TestCRecursionNrrrrrr8kr7r8N)	rrZtest.test_jsonrrrr
r6r8rrrr�<module>sa