Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_pstats.cpython-310.opt-1.pyc

o

0�i=
�@sxddlZddlmZddlmZddlmZddlZddlZGdd�dej�Z	Gdd�dej�Z
ed	kr:e��dSdS)
�N)�support)�StringIO)�SortKeyc@seZdZdZdd�ZdS)�AddCallersTestCasez$Tests for pstats.add_callers helper.cCsdddi}ddd�}t�||�}|�|ddd��ddi}ddd�}t�||�}|�|ddd��dS)	N�a)����)����)r�b)rr
rrrrr)�pstatsZadd_callers�assertEqual)�self�target�sourceZnew_callers�r�7/opt/alt/python310/lib64/python3.10/test/test_pstats.py�test_combine_results
s

z'AddCallersTestCase.test_combine_resultsN)�__name__�
__module__�__qualname__�__doc__rrrrrr
src@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
StatsTestCasecCst�d�}t�|�|_dS)Nz
pstats.pck)rZfindfiler�Stats�stats)rZ
stats_filerrr�setUps
zStatsTestCase.setUpcCs&t�}tj|d�}|�|j|j�dS)N)�stream)rrr�addr)rr rrrr�test_add!szStatsTestCase.test_addcCsLddddd�}|��D]\}}|j�|�|�|jj|jj|d�qdS)N�stdname�calls�time�
cumulative)���rrrr')�itemsr�
sort_statsr�	sort_type�sort_arg_dict_default)rZ
valid_argsZarg_intZarg_strrrr�test_sort_stats_int&s�
��z!StatsTestCase.test_sort_stats_intcCs6dD]}|j�|�|�|jj|jj|d�qdS)N)
r$ZncallsZcumtimer&�filename�line�module�nameZnflZpcallsr#r%Ztottimer'�rr)rr*r+)r�	sort_namerrr�test_sort_stats_string0s
��z$StatsTestCase.test_sort_stats_stringcCs:d}dD]}|j�|�|�|jj|jj|d�qdS)Nr-)�fZfiZfil�fileZfilenZfilenaZfilenamr-r'r1)rZsortkeyr2rrr�test_sort_stats_partial8s
��z%StatsTestCase.test_sort_stats_partialcCs0|�t|jjdtj�|�t|jjtjd�dS)Nr$)ZassertRaises�	TypeErrorrr)rZTIME�rrrr�test_sort_starts_mix@s��z"StatsTestCase.test_sort_starts_mixcCs�dd�}dd�}dd�}t��}|��|�|�|�|��t�|�}|��}t|j�	��}|�
d|�|�
d|�|�
d	|�dS)
NcS�dS�Nrrrrr�pass1I�z3StatsTestCase.test_get_stats_profile.<locals>.pass1cSr:r;rrrrr�pass2Jr=z3StatsTestCase.test_get_stats_profile.<locals>.pass2cSr:r;rrrrr�pass3Kr=z3StatsTestCase.test_get_stats_profile.<locals>.pass3r<r>r?)�cProfileZProfileZenableZcreate_statsrrZget_stats_profile�setZ
func_profiles�keysZassertIn)rr<r>r?ZprZpsZ
stats_profileZfuncs_calledrrr�test_get_stats_profileHs
z$StatsTestCase.test_get_stats_profilecCs"|�tjd�|�tjtj�dS)Nr-)rrZFILENAMEZassertNotEqualZCALLSr8rrr�test_SortKey_enum[szStatsTestCase.test_SortKey_enumN)rrrrr"r,r3r6r9rCrDrrrrrs
r�__main__)
Zunittest�testr�iorrrr@ZTestCaserrr�mainrrrr�<module>sC�