Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_heapq.cpython-310.pyc
o

�9j�A�@s�dZddlZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZejddgd	�Z
ejddgd
�Zgd�ZGdd
�d
e�Zdd�ZGdd�d�ZGdd�dee�Ze	ed�Gdd�dee��ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd �d �ZGd!d"�d"�ZGd#d$�d$�ZGd%d&�d&�ZGd'd(�d(�ZGd)d*�d*�Zdd+lm Z d,d-�Z!Gd.d/�d/�Z"Gd0d1�d1�Z#Gd2d3�d3e#e�Z$e	ed�Gd4d5�d5e#e��Z%e&d6kr�e�'�dSdS)7zUnittests for heapq.�N)�support)�
import_helper)�TestCase�
skipUnless)�
itemgetter�heapq�_heapq)�blocked)�fresh)�heapify�heappop�heappush�heappushpop�heapreplace�_heappop_max�_heapreplace_max�_heapify_maxc@s&eZdZdd�Zeed�dd��ZdS)�TestModulescC�"tD]}|�tt|�jd�qdS)Nr)�
func_names�assertEqual�getattr�py_heapq�
__module__��self�fname�r�&/usr/lib/python3.10/test/test_heapq.py�test_py_functionss�zTestModules.test_py_functions�requires _heapqcCr)Nr)rrr�c_heapqrrrrr�test_c_functionss�zTestModules.test_c_functionsN)�__name__r�__qualname__rrr!r"rrrrrsrcCs(Gdd�d�}|�tjt|�d��|S)Nc@seZdZdd�ZdS)z+load_tests.<locals>.HeapqMergeDocTestFinderc_st��}|�tj�S�N)�doctest�
DocTestFinder�findr�merge)r�args�kwargs�dtfrrrr((sz0load_tests.<locals>.HeapqMergeDocTestFinder.findN)r#rr$r(rrrr�HeapqMergeDocTestFinder'sr-)�test_finder)�addTestsr&�DocTestSuiter)�loader�tests�ignorer-rrr�
load_testss

�r4c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�TestHeapcCs�g}g}|�|�td�D]}t��}|�|�|j�||�|�|�q
g}|r;|j�|�}|�|�|�|�|s)|dd�}|��|�||�|�|�|�	t
|jjg�z|�	t
|jjdd�|�	t
|jjd�WdStyyYdSw)N�)�check_invariant�range�random�append�moduler
r�sortr�assertRaises�	TypeError�AttributeError)r�heap�data�i�item�results�data_sortedrrr�
test_push_pop2s2



�
�zTestHeap.test_push_popcCs8t|�D]\}}|r|dd?}|�|||k�qdS�N�)�	enumerate�
assertTrue)rr@�posrC�	parentposrrrr7Ns��zTestHeap.check_invariantcCsVttd��dgD]}dd�t|�D�}|j�|�|�|�q	|�t|jjd�dS)N�� NcS�g|]}t���qSr�r9)�.0�dummyrrr�
<listcomp>W�z)TestHeap.test_heapify.<locals>.<listcomp>)�listr8r;rr7r=r>)r�sizer@rrr�test_heapifyUs
zTestHeap.test_heapifycCsjdd�td�D�}g}|D]}|j�||�t|�dkr"|j�|�q
|��|�|t|�dd��dS)NcS�g|]}t�d��qS����r9�	randrange�rQrBrrrrS^�z-TestHeap.test_naive_nbest.<locals>.<listcomp>���
���)r8r;r
�lenrr<r�sorted�rrAr@rCrrr�test_naive_nbest]s�zTestHeap.test_naive_nbestccs*�z		|j�|�VqtyYdSwr%)r;r�
IndexError)rr@rrr�heapitergs���zTestHeap.heapitercCs�dd�td�D�}|dd�}|j�|�|dd�D]}||dkr*|j�||�q|�t|�|��t|�dd��|�t	|jjd�|�t	|jjdd�|�t
|jjgd�dS)NcSrXrYr[r]rrrrSur^z'TestHeap.test_nbest.<locals>.<listcomp>r_r`rra)r8r;rrrrUrgrcr=r>rfrdrrr�
test_nbestos�"zTestHeap.test_nbestcCs�dd�td�D�}|dd�}|j�|�|dd�D]	}|j�||�q|�t|�|��t|�dd��|�|j�gd�d�dS)NcSrXrYr[r]rrrrS�r^z4TestHeap.test_nbest_with_pushpop.<locals>.<listcomp>r_r`ra�x)r8r;rrrrUrgrcrdrrr�test_nbest_with_pushpop�s"z TestHeap.test_nbest_with_pushpopcCs�g}|j�|d�}|�||fgdf�dg}|j�|d�}|�||fdgdf�|�t|d�t�|�t|�t�dg}|j�|d�}|�||fdgdf�dg}|j�|d�}|�||fdgdf�dS)Nr`g$@r�	�)r;rr�type�int�float)r�hrirrr�test_heappushpop�szTestHeap.test_heappushpopcCs4ddg}|�|j�|�d�|�|j�|�d�dS)N��)rr;r)rrprrr�test_heappop_max�szTestHeap.test_heappop_maxcs�td�D]C}t�d�}dd�t|�D�}|d@r%|dd���j���ng�|D]	}�j��|�q)��fdd�t|�D�}��|t|��qdS)N�d�2cSrX)�r[r]rrrrS�r^z*TestHeap.test_heapsort.<locals>.<listcomp>rHcsg|]}�j����qSr)r;rr]�r@rrrrS�s)r8r9r\r;rr
rrc)r�trialrVrArC�heap_sortedrrxr�
test_heapsort�s
�zTestHeap.test_heapsortc
Cs�g}tt�d��D]#}g}tt�d��D]}t�d�t�dd�f}|�|�q|�|�q	dtd�td�tdd�fD]:}dD]5}g}|D]}	|�t|	||d	��qD|�tt|�||d	�t	|j
j|||d	����|�t	|j
���g�q>q:dS)
Nrwru�ABCi�����rrH)FT��key�reverse)r8r9r\�choicer:rrcr�chainrUr;r))
r�inputsrB�row�j�tuprr��seqs�seqrrr�
test_merge�s$���zTestHeap.test_mergecCs@|�t|j�gg��g�|�t|jjggdd�d��g�dS)NcS�dS)N�rrrrr�<lambda>��z,TestHeap.test_empty_merges.<locals>.<lambda>�r)rrUr;r)�rrrr�test_empty_merges�s&zTestHeap.test_empty_mergescCsNdd�}|�t��t|j�|�|���Wd�dS1s wYdS)Ncss*�ttd��}td�D]}||VqdS)Nr`�)rUr8)�srBrrr�iterable�s
��zCTestHeap.test_merge_does_not_suppress_index_error.<locals>.iterable)r=rfrUr;r))rr�rrr�(test_merge_does_not_suppress_index_error�s"�z1TestHeap.test_merge_does_not_suppress_index_errorcCs�Gdd�dt�}ggggg}td�D]}t�d�}t�d�}||�}||f|_||�|�q|D]}|��q1dd�|jj|�D�}|�	|t
|��dS)Nc@seZdZdS)z*TestHeap.test_merge_stability.<locals>.IntN)r#rr$rrrr�Int�sr�rN�r}cSsg|]}|j�qSr)�pairr]rrrrS�sz1TestHeap.test_merge_stability.<locals>.<listcomp>)rnr8r9r\r�r:r<r;r)rrc)rr�r�rB�streamri�obj�resultrrr�test_merge_stability�s



zTestHeap.test_merge_stabilityc
Cs�dd�td�D�}ddd�fD]1}dD],}|�t|j�||��t|�d|��|�t|jj|||d��t||d�d|��qqdS)NcS�g|]	}t�d�|f�qSrYr[r]rrrrS��z+TestHeap.test_nsmallest.<locals>.<listcomp>r_cS�|dddS�Nri#rZr�rirrrr���z)TestHeap.test_nsmallest.<locals>.<lambda>�	rrHrsr`rui�i�r_iLr�)r8rrUr;�	nsmallestrc�rrA�f�nrrr�test_nsmallest�s����zTestHeap.test_nsmallestc
Cs�dd�td�D�}ddd�fD]4}dD]/}|�t|j�||��t|dd�d|��|�t|jj|||d	��t||dd
�d|��qqdS)NcSr�rYr[r]rrrrS�r�z*TestHeap.test_nlargest.<locals>.<listcomp>r_cSr�r�rr�rrrr��r�z(TestHeap.test_nlargest.<locals>.<lambda>r�T�r�r�r~)r8rrUr;�nlargestrcr�rrr�
test_nlargest�s����zTestHeap.test_nlargestcsj�fdd�}Gdd�d�}Gdd�d�}dd�td	�D�}t|d
d�}��|||�|���t||�dS)Ncs:�fdd��D���j�����fdd�tt���D�S)Ncsg|]}�|��qSrr)rQri)�comprrrS�rTzDTestHeap.test_comparison_operator.<locals>.hsort.<locals>.<listcomp>csg|]	}�j���j�qSr)r;rrir])rArrrrS�r�)r;rr8rb)rAr�r�)r�rAr�hsort�sz0TestHeap.test_comparison_operator.<locals>.hsortc@�eZdZdd�Zdd�ZdS)z-TestHeap.test_comparison_operator.<locals>.LTcS�
||_dSr%r��rrirrr�__init__��
z6TestHeap.test_comparison_operator.<locals>.LT.__init__cSs|j|jkSr%r��r�otherrrr�__lt__��z4TestHeap.test_comparison_operator.<locals>.LT.__lt__N�r#rr$r�r�rrrr�LT��r�c@r�)z-TestHeap.test_comparison_operator.<locals>.LEcSr�r%r�r�rrrr�r�z6TestHeap.test_comparison_operator.<locals>.LE.__init__cSs|j|jkSr%r�r�rrr�__le__r�z4TestHeap.test_comparison_operator.<locals>.LE.__le__N)r#rr$r�r�rrrr�LEr�r�cSrOrrPr]rrrrSrTz5TestHeap.test_comparison_operator.<locals>.<listcomp>ruTr�)r8rcrr=r>)rr�r�r�rA�targetrr�r�test_comparison_operator�sz!TestHeap.test_comparison_operatorN)r#rr$rFr7rWrergrhrjrqrtr{r�r�r�r�r�r�r�rrrrr50s$
				r5c@�eZdZeZdS)�TestHeapPythonN�r#rr$rr;rrrrr��r�r c@r�)�	TestHeapCN�r#rr$r!r;rrrrr��r�c@seZdZdZdd�ZdS)�LenOnlyz:Dummy sequence class defining __len__ but not __getitem__.cCr��Nr`rr�rrr�__len__�zLenOnly.__len__N)r#rr$�__doc__r�rrrrr�sr�c@s,eZdZdZdd�ZeZZZZZ	dS)�CmpErrz;Dummy element that always raises an error during comparisoncC�t�r%)�ZeroDivisionErrorr�rrr�__eq__r�z
CmpErr.__eq__N)
r#rr$r�r��__ne__r�r��__gt__�__ge__rrrrr�sr�ccs�|D]}|VqdS)zRegular generatorNr��seqnrBrrr�R"s��r�c@� eZdZdZdd�Zdd�ZdS)�GzSequence using __getitem__cCr�r%�r��rr�rrrr�)r�z
G.__init__cCs
|j|Sr%r�)rrBrrr�__getitem__+r�z
G.__getitem__N)r#rr$r�r�r�rrrrr�'sr�c@�(eZdZdZdd�Zdd�Zdd�ZdS)	�Iz Sequence using iterator protocolcC�||_d|_dS�Nrr�r�rrrr�0�
z
I.__init__cC�|Sr%rr�rrr�__iter__3r�z
I.__iter__cC�2|jt|j�kr
t�|j|j}|jd7_|SrG�rBrbr��
StopIteration�r�vrrr�__next__5�z
I.__next__N�r#rr$r�r�r�r�rrrrr�.�
r�c@r�)�Igz9Sequence using iterator protocol defined with a generatorcCr�r�r�r�rrrr�=r�zIg.__init__ccs�|jD]}|VqdSr%r�)r�valrrrr�@s�
�zIg.__iter__N�r#rr$r�r�r�rrrrr�;�r�c@r�)�Xz Missing __getitem__ and __iter__cCr�r�r�r�rrrr�Fr�z
X.__init__cCr�rGr�r�rrrr�Ir�z
X.__next__N)r#rr$r�r�r�rrrrr�Dr�r�c@r�)�NzIterator missing __next__()cCr�r�r�r�rrrr�Qr�z
N.__init__cCr�r%rr�rrrr�Tr�z
N.__iter__Nr�rrrrr�Or�r�c@r�)	�EzTest propagation of exceptionscCr�r�r�r�rrrr�Yr�z
E.__init__cCr�r%rr�rrrr�\r�z
E.__iter__cCsdddS)Nrrrrr�rrrr�^r�z
E.__next__Nr�rrrrr�Wr�r�c@r�)	�SzTest immediate stopcCsdSr%rr�rrrr�cr�z
S.__init__cCr�r%rr�rrrr�er�z
S.__iter__cCr�r%)r�r�rrrr�gr�z
S.__next__Nr�rrrrr�as
r�)r�cCsttdd�ttt|�����S)z Test multiple tiers of iteratorscSr�r%rr�rrrr�mr�zL.<locals>.<lambda>)r��mapr�r�r�r�rrr�Lksr�c@r�)�SideEffectLTcCs||_||_dSr%)�valuer@)rr�r@rrrr�qr�zSideEffectLT.__init__cCsg|jdd�<|j|jkSr%)r@r�r�rrrr�uszSideEffectLT.__lt__Nr�rrrrr�psr�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestErrorHandlingcCsb|jj|jjfD]}|�ttf|d�q|jj|jj|jj|jj	fD]}|�ttf|dd�q"dSr�)
r;rrr=r>r?r
rr�r��rr�rrr�test_non_sequence|s��z#TestErrorHandling.test_non_sequencecCs�|jj|jjfD]}|�ttf|t��q|jj|jjfD]
}|�ttf|t�d�q|jj	|jj
fD]}|�t|dt��q3dS�Nr`rs)r;rrr=r>r?r�r
rr�r�r�rrr�
test_len_only�s�zTestErrorHandling.test_len_onlycCs�t�t�t�g}|jj|jjfD]	}|�t||�q|jj|jjfD]
}|�t||d�q"|jj|jj	fD]
}|�t|d|�q5dSr�)
r�r;rrr=r�r
rr�r�)rr�r�rrr�test_cmp_err�s�zTestErrorHandling.test_cmp_errcCsD|jj|jj|jj|jj|jj|jjfD]}|�tt	f|d�qdSr�)
r;rrr
rr�r�r=r>r?r�rrr�test_arg_parsing�s��z"TestErrorHandling.test_arg_parsingc
Cs�|jj|jjfD]Y}ddtd�dtddd�fD]I}tttttfD]}|�	t
|d||���t
|d|���q |�	t
|dt|���g�|�t
|dt|��|�t
|dt|��|�t|dt|��qqdS)	N�123�r_)rHg333333�?rZi��rs)r;r�r�r8r�r�r�r�r�rrUr�r=r>r�r�r�r�)rr�r��grrr�test_iterable_args�s&��z$TestErrorHandling.test_iterable_argscshg����fdd�td�D��|�ttf��|j��td���Wd�dS1s-wYdS)Nc3��|]}t|��VqdSr%�r�r]�r@rr�	<genexpr>���z@TestErrorHandling.test_heappush_mutating_heap.<locals>.<genexpr>��r�)�extendr8r=rf�RuntimeErrorr;r
r�r�rrr�test_heappush_mutating_heap�s
"�z-TestErrorHandling.test_heappush_mutating_heapcs`g����fdd�td�D��|�ttf��|j���Wd�dS1s)wYdS)Nc3rr%rr]rrrr�rz?TestErrorHandling.test_heappop_mutating_heap.<locals>.<genexpr>r)rr8r=rfrr;rr�rrr�test_heappop_mutating_heap�s
"�z,TestErrorHandling.test_heappop_mutating_heapcsBG�fdd�dt�}g�|j��|d��|�t|jj�d�dS)Nc�eZdZ�fdd�ZdS)zMTestErrorHandling.test_comparison_operator_modifiying_heap.<locals>.EvilClassc����tSr%��clear�NotImplemented�r�orrrr���zTTestErrorHandling.test_comparison_operator_modifiying_heap.<locals>.EvilClass.__lt__N�r#rr$r�rrrr�	EvilClass��rrrH)rnr;r
r=rfr)rrrrr�(test_comparison_operator_modifiying_heap�sz:TestErrorHandling.test_comparison_operator_modifiying_heapcs�G�fdd�dt�}G�fdd�dt�}gg��|j��|d��|j��|d��|�ttf|jj�|d��|�ttf|jj�|d��dS)Ncr
)zOTestErrorHandling.test_comparison_operator_modifiying_heap_two_heaps.<locals>.hcrr%rr��list2rrr��rzVTestErrorHandling.test_comparison_operator_modifiying_heap_two_heaps.<locals>.h.__lt__Nrrrrrrp�rrpcr
)zOTestErrorHandling.test_comparison_operator_modifiying_heap_two_heaps.<locals>.gcrr%rr��list1rrr��rzVTestErrorHandling.test_comparison_operator_modifiying_heap_two_heaps.<locals>.g.__lt__Nrrrrrr��rr�rrH)rnr;r
r=rfr)rrpr�r)rrr�2test_comparison_operator_modifiying_heap_two_heaps�s
 zDTestErrorHandling.test_comparison_operator_modifiying_heap_two_heapsN)r#rr$r�r�r�r�r�rr	rrrrrrr�zs	r�c@r�)�TestErrorHandlingPythonNr�rrrrr�r�rc@r�)�TestErrorHandlingCNr�rrrrr�r�r�__main__)(r�r9�unittestr&�testr�test.supportrrr�operatorr�import_fresh_modulerr!rrr4r5r�r�r�r�r�r�r�r�r�r�r�r��	itertoolsr�r�r�r�rrr#�mainrrrr�<module>sL]
	
	
Z�

Youez - 2016 - github.com/yon3zu
LinuXploit