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/__pycache__/test_defaultdict.cpython-310.opt-1.pyc
o

�i��@sjdZddlZddlZddlZddlZddlZddlmZdd�ZGdd�dej	�Z
edkr3e��dSdS)	z'Unit tests for collections.defaultdict.�N)�defaultdictcCstS�N)�list�rr�2/usr/local/lib/python3.10/test/test_defaultdict.py�foobar�rc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestDefaultDictc
Cs�t�}|�|jd�t|_|d�d�|�|ddgi�|d�d�|�|dddgi�|d|d|�|ddgggd��|�|d|duoS|dun�ttddd	�}|�|jt�|�|ddd	��|�|d
d�|�|dd�|�|dg�|�d
|�|�d
|���|�d|�|�d|���|�d|�|�d|���|�d|�|�d|���d|_|�|jd�z|dWnt	y�}z
|�|j
d
�WYd}~n
d}~ww|�d�|�t
td�dS)N��*��
�)r
r
r��)�foo�barrr�)rzd2[15] didn't raise KeyError)r�assertEqual�default_factoryr�append�
assertTrueZassertIn�keysZassertNotIn�KeyError�args�fail�assertRaises�	TypeError)�self�d1�d2�errrrr�
test_basicsF*��
zTestDefaultDict.test_basiccCs2t�}|�t|jd�t|_|�|�d�g�dS)Nr)rrr�__missing__rrr)rrrrr�test_missing4szTestDefaultDict.test_missingcCs�t�}|�|jd�|�t|�d�|�tt|��|�d|d<|�t|�d�tt�}|�|jt�d|d<|�t|�d�dd	�}t|�}|�|j|u�|d
|�t|�dt|��dS)Nzdefaultdict(None, {})�)�zdefaultdict(None, {11: 41})rr
z$defaultdict(<class 'int'>, {12: 42})cSsdS)N�+rrrrrrEsz&TestDefaultDict.test_repr.<locals>.foor
zdefaultdict(%s, {13: 43}))rrr�repr�eval�intr)rrr r�d3rrr�	test_repr:szTestDefaultDict.test_reprcCs�t�}|��}|�t|�t�|�|jd�|�|i�t|_|��}|�t|�t�|�|jt�|�|i�|d|��}|�t|�t�|�|jt�|�|dgi�|d|�|ggd��t�}d|d<|��}|�|dd�dS)Nrr
)rr
�a)r�copyr�typerr)rrr r+Zd4�d�errr�	test_copyKs*zTestDefaultDict.test_copycCs`ttddi�}t�|�}|�|jt�|�||�t|_t�|�}|�|jt�|�||�dS�Nr)rrr.rrr�rrr rrr�test_shallow_copyds

z!TestDefaultDict.test_shallow_copycCsxttddgi�}t�|�}|�|jt�|�||�|�|d|du�t|_t�|�}|�|jt�|�||�dSr3)rrr.�deepcopyrrrrr4rrr�test_deep_copyns

zTestDefaultDict.test_deep_copyc
CsZt�}z|dWnty%}z|�|jdd�WYd}~dSd}~ww|�d�dS)N)rrzexpected KeyError)rrrrr)rrr!rrr�test_keyerror_without_factoryys ��z-TestDefaultDict.test_keyerror_without_factorycCs*Gdd�dt�}|�}|�t|�d�dS)Nc@seZdZdd�Zdd�ZdS)z0TestDefaultDict.test_recursive_repr.<locals>.subcSs|j|_dSr)�_factoryr�rrrr�__init__�sz9TestDefaultDict.test_recursive_repr.<locals>.sub.__init__cSsgSrrr:rrrr9�rz9TestDefaultDict.test_recursive_repr.<locals>.sub._factoryN)�__name__�
__module__�__qualname__r;r9rrrr�sub�sr?zBsub\(<bound method .*sub\._factory of sub\(\.\.\., \{\}\)>, \{\}\))rZassertRegexr()rr?r0rrr�test_recursive_repr�s

�z#TestDefaultDict.test_recursive_reprcCs|�tti�dSr)rrrr:rrr�test_callable_arg�sz!TestDefaultDict.test_callable_argcCsJtt�}|dttjd�D]}t�||�}t�|�}|�||�qdSr3)rr*�range�pickle�HIGHEST_PROTOCOL�dumps�loadsr)rr0�proto�s�orrr�
test_pickling�s
�zTestDefaultDict.test_picklingcCsttddd��}ttddd��}||B}|�|jt�|�|dddd��|�t|�gd��||B}|�|jt�|�|dddd��|�t|�gd��|t|�B}|�|jt�|�|dddd��|�t|�gd��t|�|B}|�|jt�|�|dddd��|�t|�gd��|�	t
��|t|���BWd�n1s�wY|�	t
��t|���|BWd�n1s�wY|t|���O}|�|jt�|�|dddd��|�t|�gd��|�	t
��
|dO}Wd�dS1�swYdS)	Nrr)rrZzeroZone)rr)rrr)rrr)rr*�strZassertIsrZassertDictEqualrr�dictrr�items)r�irHZi_sZs_iZi_dsZds_irrr�
test_union�s>��
$�zTestDefaultDict.test_unionN)r<r=r>r"r$r,r2r5r7r8r@rArJrOrrrrr	s$
	r	�__main__)
�__doc__�osr.rC�tempfileZunittest�collectionsrrZTestCaser	r<�mainrrrr�<module>s2�