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

��g��@sfdZddlZddlZddlZddlZddlZddlmZdd�ZGdd�dej	�Z
edkrbe��dS)	z'Unit tests for collections.defaultdict.�N)�defaultdictcCstS)N)�list�rr�1/usr/local/lib/python3.7/test/test_defaultdict.py�foobarsrc@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|dk	o�|dk	n�ttddd	�}|�|jt�|�|ddd	��|�|d
d�|�|dd�|�|dg�|�d
|�|�d
|���|�d|�|�d|���|�d|�|�d|���|�d|�|�d|���d|_|�|jd�y|dWn2t	k
�r�}z|�|j
d
�Wdd}~XYnX|�d�|�t
td�dS)N��*��
�)rrr��)�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_basicsB* 
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|k�|d
|�t|�dt|��dS)Nzdefaultdict(None, {})�)�zdefaultdict(None, {11: 41})r	rz$defaultdict(<class 'int'>, {12: 42})cSsdS)N�+rrrrrrE�z&TestDefaultDict.test_repr.<locals>.foorzdefaultdict(%s, {13: 43}))rrr�repr�eval�intr)rrrr�d3rrr�	test_repr:szTestDefaultDict.test_reprc	Cs�t�}dd�}t|ddi�}t��}zpt|d�}zVt||d�t||d�|�d�|�|��t|�d�|�|��t|�d�Wd|�	�XWdt
�|�XdS)	NcSsdS)Nr	rrrrrrMr&z'TestDefaultDict.test_print.<locals>.foor
rzw+)�filer�
)r�tempfile�mktemp�open�print�seekr�readliner'�close�os�remove)rrrr�tfn�frrr�
test_printKs

zTestDefaultDict.test_printcCs�t�}|��}|�t|�t�|�|jd�|�|i�t|_|��}|�t|�t�|�|jt�|�|i�|d|��}|�t|�t�|�|jt�|�|dgi�|d|�|ggd��t�}d|d<|��}|�|dd�dS)Nr	r)r	r�a)r�copyr�typerr)rrrr*Zd4�d�errr�	test_copy`s*zTestDefaultDict.test_copycCs`ttddi�}t�|�}|�|jt�|�||�t|_t�|�}|�|jt�|�||�dS)Nr
)rrr;rrr)rrrrrr�test_shallow_copyys

z!TestDefaultDict.test_shallow_copycCsxttddgi�}t�|�}|�|jt�|�||�|�|d|dk	�t|_t�|�}|�|jt�|�||�dS)Nr
)rrr;Zdeepcopyrrrr)rrrrrr�test_deep_copy�s

zTestDefaultDict.test_deep_copyc
CsVt�}y|dWn4tk
rF}z|�|jdd�Wdd}~XYnX|�d�dS)N)r
rzexpected KeyError)rrrrr)rrrrrr�test_keyerror_without_factory�s$z-TestDefaultDict.test_keyerror_without_factoryc	CsjGdd�dt�}|�}|�t|�d�t��}z*t|d�}zt||d�Wd|��XWdt�	|�XdS)Nc@seZdZdd�Zdd�ZdS)z0TestDefaultDict.test_recursive_repr.<locals>.subcSs|j|_dS)N)�_factoryr)rrrr�__init__�sz9TestDefaultDict.test_recursive_repr.<locals>.sub.__init__cSsgS)Nr)rrrrrC�sz9TestDefaultDict.test_recursive_repr.<locals>.sub._factoryN)�__name__�
__module__�__qualname__rDrCrrrr�sub�srHzBsub\(<bound method .*sub\._factory of sub\(\.\.\., \{\}\)>, \{\}\)zw+)r,)
rZassertRegexr'r.r/r0r1r4r5r6)rrHr=r7r8rrr�test_recursive_repr�s

z#TestDefaultDict.test_recursive_reprcCs|�tti�dS)N)rrr)rrrr�test_callable_arg�sz!TestDefaultDict.test_callable_argcCsNtt�}|dx8ttjd�D]&}t�||�}t�|�}|�||�q WdS)Nr
)rr)�range�pickleZHIGHEST_PROTOCOL�dumps�loadsr)rr=�proto�s�orrr�
test_pickling�s
zTestDefaultDict.test_picklingN)rErFrGr r"r+r9r?r@rArBrIrJrRrrrrrs$
	r�__main__)
�__doc__r5r;rLr.Zunittest�collectionsrrZTestCaserrE�mainrrrr�<module>s-