Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
queues_test.cpython-313.pyc74 linesDownload Raw Back to __pycache__
1�

2��jL8��"�SSKrSSKJr SSKJr SSKrSSKJrJr SSKJ	r	 SSK3JrJr "SS\5r
"S	S4\5r"SS\5r"S
S\5r"SS\5r"SS\5r"SS\5r\S:Xa\R*"5 gg)�N)�	timedelta)�random)�gen�queues)�TimeoutError)�gen_test�
AsyncTestCasec�0�\rSrSrSrSr\S5rSrg)�QueueBasicTest�c��[R"SS9nUR[[	U55[U55 UR
[[	U55[U55 UR5 [U5[U54HknURURS55 URSU5 URSU5 UR
SU5 UR
SU5 Mm URS5 URS5 URS5 [U5[U54H9nUR
SU5 URS	U5 URS5U5 M; g)N���maxsizez<Queuez	maxsize=1z6getters[1]�putters�tasks�gettersz7putters[1]ztasks=2)r�Queue�assertIn�hex�id�repr�assertNotIn�str�get�8assertTrue�9startswith�put)�self�q�q_strs   �^D:\code\apps\devtools\python\user_packages\Python313\site-packages\tornado/test/queues_test.py�test_repr_and_str� QueueBasicTest.test_repr_and_strs���L�L��#���
�
�c�"�Q�%�j�$�q�'�*�����R��U��S��V�,�	�����!�W�c�!�f�_�E��O�O�E�,�,�X�6�7��M�M�+�u�-��M�M�,��.����Y��.����W�e�,�%�	10���d��	���d��	���d���!�W�c�!�f�_�E����Y��.��M�M�,��.��M�M�)�U�+�%�c���[R"5nSHnURU5 M [S5Vs/sHo1R	5PM nnUR/SQU5 gs snf)N)r��r')rr�11put_nowait�range�12get_nowait�assertEqual)rr �i�_�itemss     r"�13test_order�QueueBasicTest.test_order/sU���L�L�N���A�
�L�L��O��*/�q��2��A������2�����E�*��3s�A-c#�# �UR[[RSS9 UR[[RSS9 [R"SS9nURUR
55 URUR55 URSUR5 URURS5R55 URURS5R55 URUR
55 URUR55 URS5nURUR55 URSUR5v�5 URUR55 URUR
55 URUR55 g7f)Nr�����r(rr)�assertRaises�	TypeErrorrr�14ValueErrorr�empty�assertFalse�fullr,rr�doner)rr �put2s   r"�test_maxsize�QueueBasicTest.test_maxsize7sJ������)�V�\�\�4��@����*�f�l�l�B��?��L�L��#��������	�"��������"�����A�I�I�&�������a��
�
��(�������a��
�
��(��������#��������!��u�u�Q�x���������%�����1�5�5�7�]�,�����	�	��$��������#��������!�s�G?H�N)	�__name__�15__module__�__qualname__�__firstlineno__r#r0rr<�__static_attributes__r>r%r"rrs ��,�.+��"��"r%rc��\rSrSr\S5rSrSr\S5r\S5r	\S5r16\S5r\S	5r\S175r
\S5rSrg
)�QueueGetTest�Lc#�# �[R"5nURS5 URSUR	5v�5 g7f�Nr)rrr)r,r�rr s  r"�test_blocking_get�QueueGetTest.test_blocking_getMs3����L�L�N��	���Q������1�5�5�7�]�,�s�A18Ac��[R"5nURS5 URSUR	55 grH)rrr)r,r+rIs  r"�test_nonblocking_get�!QueueGetTest.test_nonblocking_getSs.���L�L�N��	���Q������A�L�L�N�+r%c��[R"5nUR[RUR5 g�N)rrr4�19QueueEmptyr+rIs  r"�test_nonblocking_get_exception�+QueueGetTest.test_nonblocking_get_exceptionXs'���L�L�N�����&�+�+�Q�\�\�:r%c#��# �[R"S5nURS5 URS5nUR	SUR5v�5 UR
Uv�5 g7f�Nrr)rrr)rr,r�assertIsNone�rr rs   r"�test_get_with_putters�"QueueGetTest.test_get_with_putters\sR����L�L��O��	���Q���e�e�A�h������1�5�5�7�]�,�����9�&�s�A/A1c	#�# �[R"5nURS5 URR	SUR20S5 URR	SUR21S5 UR
SUR[SS9S9v�5 UR
SUR[SS9S9v�5 g7f)Nr�{�G�z�?r�{�G�z�?r(��seconds��timeout)	rrr�io_loop�22call_laterr)r,rrrIs  r"�test_blocking_get_wait�#QueueGetTest.test_blocking_get_waitds�����L�L�N��	���a��������a�l�l�A�6�������a�l�l�A�6�����1�5�5��1�1E�5�#F�F�H�����1�5�5��1�1E�5�#F�F�H�s�CCc#�2# �[R"5nUR[SS9S9nUR5nUR	[235 Uv� SSS5 UR
S5 URSUv�5 g!,(df   N4=f7f)Nr[r]r_r)rrrrr4rr)r,)rr �get_timeoutrs    r"�test_get_timeout�QueueGetTest.test_get_timeoutmsp����L�L�N���e�e�I�d�$;�e�<���e�e�g��
�
�
�|�
,���-�	24���Q������3�Y�(�	-�
,�s�AB�B�.B�25B�Bc#��# �[R"5nUR[SS9S9nUR	S5 [26R"S5v� URSUv�5 g7f)Nr[r]r_rr\)rrrrrr�sleepr,)rr rs   r"�test_get_timeout_preempted�'QueueGetTest.test_get_timeout_preemptedxsP����L�L�N���e�e�I�d�3�e�4��	���a���i�i��o������3�Y�(�s�A*A,c27#��# �[R"S5n[S5Vs/sHo!RU[	SS95PM nnURS5nURS[
UR55 [R"S5v� URS[
UR55 URUR55 URS5 URSUR5v�5 URS[
UR55 USSH#nUR[UR5 M% gs snf7f)Nr�28r[r]r\�r)rrr*rrr,�len�_puttersrrjr8r:rr4r�result�rr r-rr�putters      r"�!test_get_clears_timed_out_putters�.QueueGetTest.test_get_clears_timed_out_putters�s�����L�L��O��>C�B�i�H�i��5�5��I�d�3�4�i��H��e�e�B�i������S����_�-��i�i��o������S����_�-��������$�	���b�	�����1�5�5�7�]�,�����C��29�30�O�,��a�b�k�F����l�F�M�M�:�"��I�s�$E&�"E!�DE&c#��# �[R"5n[S5Vs/sH/n[R"UR[
SS955PM1 nn[R"UR55nURS[UR55 [R"S5v� URS[UR55 URUR55 UR5 URS[UR55 UH#nUR[UR 5 M% gs snf7f)Nrnr[r]ror\r()rrr*�asyncio�
ensure_futurerrr,rp�_gettersrrjr8r:r4rrr�rr r.rr�getters      r"�!test_get_clears_timed_out_getters�.QueueGetTest.test_get_clears_timed_out_getters�s�����L�L�N��KP�QS�9�31�KT�a�G�!�!�!�%�%�	�$�(?�"@�A�9�	�32��#�#�A�E�E�G�,������S����_�-��i�i��o������S����_�-��������$�	��������C��33�34�O�,��F����l�F�M�M�:���35�s�#E&�6E!�DE&c#��^# �[R"5m[S5HnTRU5 M U4SjnU"5v�nUR	U[[S555 g7f)N�c��h># �/nTShv�NnURU5 US:XdM"Us $N!36g7f)N�)�append)�resultsr-r s  �r"�f�&QueueGetTest.test_async_for.<locals>.f�s4�����G��
#�a����q�!���6�"�N�
#�1�s �2�0�.�0�2�2�0�2)rrr*rr,�list)rr-r�r�r s    @r"�test_async_for�QueueGetTest.test_async_for�sR�����L�L�N���q��A�
�E�E�!�H��	#���)������$�u�Q�x�.�1�s�A-A0r>N)r?r@rArBrrJrMrRrXrcrgrkrur}r�rCr>r%r"rErELs���
�-��-�37,�38;��'��'��I��I��)��)��)��)��
;��
;��
;��
;��
2��
2r%rEc��\rSrSr\S5rSr\S5r\S5r\S5r	\S5r39\S5r\S	5r\S405r
\S5rSrg
)�QueuePutTest�c��[R"5nURS5 URSUR	55 grH)rrrr,r+rIs  r"�test_blocking_put�QueuePutTest.test_blocking_put�s.���L�L�N��	���a������A�L�L�N�+r%c��[R"S5nURS5 UR[RUR41S5 grU)rrrr4�	QueueFullr)rIs  r"�test_nonblocking_put_exception�+QueuePutTest.test_nonblocking_put_exception�s6���L�L��O��	���a�����&�*�*�A�L�L�!�<r%c#�# �[R"5nUR5nUR5nURS5v� UR	SUv�5 URS5v� UR	SUv�5 g7f�Nrr)rrrrr,�rr �get0�get1s    r"�test_put_with_getters�"QueuePutTest.test_put_with_getters�sd����L�L�N���u�u�w���u�u�w���e�e�A�h������4�Z�)��e�e�A�h������4�Z�)�s�BBc#�R# �[R"5nUR5nUR5nURS5 [R42v� UR
SUv�5 URS5 [R43v� UR
SUv�5 g7fr�)rrrr)r�momentr,r�s    r"�!test_nonblocking_put_with_getters�.QueuePutTest.test_nonblocking_put_with_getters�st����L�L�N���u�u�w���u�u�w��	���Q���j�j������4�Z�)�	���Q���j�j������4�Z�)�s�B%B'c#�f^# �[R"S5mTRS5 U4SjnURR	SU5 URR	SU5 TRS5TRS5/nUR
[SU555 Uv� g7f)Nrrc�&>�TR5 grP)r)r s�r"�get_and_discard�<QueuePutTest.test_blocking_put_wait.<locals>.get_and_discard�s���
�E�E�Gr%r[r\c3�@# �UHoR5v� M g7frP)r:)�.0r�s  r"�	<genexpr>�6QueuePutTest.test_blocking_put_wait.<locals>.<genexpr>�s���7�w�!�V�V�X�X�w�s�)rrr)rarbrr8�any)rr��futuresr s   @r"�test_blocking_put_wait�#QueuePutTest.test_blocking_put_wait�s������L�L��O��	���Q��	�	
������o�6�������o�6��5�5��8�Q�U�U�1�X�&������7�w�7�7�8��
�s�B.B1c#�# �[R"S5nURS5 URS[	SS9S9nURS5nUR[5 Uv� SSS5 URSUR55 URSUR5v�5 Uv� g!,(df   NU=f7f)Nrrr[r]r_r()44rrr)rrr4rr,r+r)rr �put_timeoutrs    r"�test_put_timeout�QueuePutTest.test_put_timeout�s�����L�L��O��	���Q���e�e�A�y��'>�e�?���e�e�A�h��
�
�
�|�
,���-�	
����A�L�L�N�+�����1�5�5�7�]�,��	�-�
,�s�A%C�'B;�,AC�;45C	�Cc#��# �[R"S5nURS5 URS[	SS9S9nUR5 [R"S5v� Uv� g7f)Nrrr[r]r_r\)rrr)rrrrrjrWs   r"�test_put_timeout_preempted�'QueuePutTest.test_put_timeout_preempted�sP����L�L��O��	���Q���e�e�A�y��6�e�7��	�����i�i��o���	�s�A,A.c46#�# �[R"S5n[S5Vs/sHo!RU[	SS95PM nnURS5nURS[
UR55 [R"S5v� URS[
UR55 URUR55 URS5 URS[
UR55 USSH#nUR[UR5 M% gs snf7f)Nrrnr[r]r\ror()rrr*rrr,rprqrrjr8r:r4rrrrss      r"�!test_put_clears_timed_out_putters�.QueuePutTest.test_put_clears_timed_out_putters�s�����L�L��O��>C�B�i�H�i��5�5��I�d�3�4�i��H��e�e�B�i������S����_�-��i�i��o������S����_�-��������$�	���b�	�����C��47�48�O�,��a�b�k�F����l�F�M�M�:�"��I�s�$E�"D?�C<Ec#�# �[R"5n[S5Vs/sH/n[R"UR[
SS955PM1 nn[R"UR55nUR5 URS[UR55 [R"S5v� URS[UR55 URUR55 URS5 URS[UR55 URSUv�5 UH#nUR[ UR"5 M% gs snf7f)Nrnr[r]�r\rr)rrr*rxryrrr,rprzrrjr8r:rr4rrrr{s      r"�!test_put_clears_timed_out_getters�.QueuePutTest.test_put_clears_timed_out_getters49s����L�L�N��KP�QS�9�50�KT�a�G�!�!�!�%�%�	�$�(?�"@�A�9�	�51��#�#�A�E�E�G�,��	��������S����_�-��i�i��o������S����_�-��������$�	���a������C��52�53�O�,�����3�Y�(��F����l�F�M�M�:���54�s�#F�6F�D0Fc#�# �[R"SS9nURUR55 UR	UR55 UR
S5 UR
S5 UR	UR55 URUR55 UR[RURS5 URSUR55 UR	UR55 UR	UR55 URS5v� URS5nUR	UR55 URSUR5v�5 Uv� URUR55 g7f)Ng�������?rrrr(r')rrrr7r8r9r)r4r�r,r+rr:rrWs   r"�test_float_maxsize�QueuePutTest.test_float_maxsizes.���
�L�L��%��������	�"��������"�	���Q��	���Q���������#��������!����&�*�*�A�L�L�!�<�����A�L�L�N�+��������#��������"��e�e�A�h���e�e�A�h���������$�����1�5�5�7�]�,��	��������!�s�GGr>N)r?r@rArBrr�r�r�r�r�r�r�r�r�r�rCr>r%r"r�r��s���
�,��,�55=�56�*��*��57*��58*������
��
������;��;��;��;�"�"��"r%r�c�r�\rSrSr\R59rSr\S5r	\S5r60\S5r\S5rSr
g)	�
QueueJoinTesti6c�d�UR5nUR[UR5 grP)�queue_classr4r6�	task_donerIs  r"�test_task_done_underflow�&QueueJoinTest.test_task_done_underflow9s$����������*�a�k�k�2r%c#�T^^# �TR5m[S5HnTRU5 M STl[R61UU4Sj5nU"5 U"5 TR
5v� TR[[S55TR5 g7f)N�drc3��># �TR5v�nT=RU-
slTR5 [R"[5S-5v� M\7f)Nr[)r�accumulatorr�rrjr)�itemr rs ��r"�worker�,QueueJoinTest.test_task_done.<locals>.workerEsJ������U�U�W�}��� � �D�(� ����
��i�i���4��0�0�	�s�AA!)	r�r*r)r�r�	coroutine�joinr,�sum)rr-r�r s`  @r"�test_task_done�QueueJoinTest.test_task_done=s�����������s��A�
�L�L��O�����	���	1�62�	1�	�����f�f�h������U�3�Z��$�*:�*:�;�s�B$B(c#��# �UR5nURS5 [R"UR	55nURUR
55 UR5v� URUR
55 [Rv� URUR
55 UR5 URUR
55 g7frH)r�r)rxryr�r8r:rrr�r�r)rr r�s   r"�test_task_done_delay�"QueueJoinTest.test_task_done_delaySs����
�����	���Q���$�$�Q�V�V�X�.���������%��e�e�g�
��������%��j�j���������%�	���
�����	�	��$�s�C7C9c#�t# �UR5nUR5v� UR5v� g7frP)r�r�rIs  r"�test_join_empty_queue�#QueueJoinTest.test_join_empty_queueas)���������f�f�h���f�f�h��s�68c#��# �UR5nURS5 UR[5 UR	[SS9S9v� SSS5 g!,(df   g=f7f)Nrr[r]r_)r�rr4rr�rrIs  r"�test_join_timeout�QueueJoinTest.test_join_timeoutgsM��������	���a��
�
�
�|�
,��&�&��4�!8�&�9�9�-�
,�
,�s�7A,�A�	A,�63A)�%A,)r�N)r?r@rArBrrr�r�rr�r�r�r�rCr>r%r"r�r�6s`���,�,�K�3��<��<�*�%��%�����64�:��:r%r�c�<�\rSrSr\R65r\S5rSr	g)�PriorityQueueJoinTestioc#�6# �URSS9nURS5 URS5 URUR55 UR	S5 UR	S5 URSUR
55 URSUR5v�5 URSUR
55 URSUR5v�5 URUR55 g7f)Nr(r)r�a)r�b)r'�c)r(�d�	r�r)rr9rr,r+rr7rIs  r"r0� PriorityQueueJoinTest.test_orderrs�������Q��'��	���X��	���X���������!�	���h��	���h������1�<�<�>�2�����!�%�%�'�M�3�����1�<�<�>�2�����!�%�%�'�M�3�������	�"���DDr>N)66r?r@rArBr�
PriorityQueuer�rr0rCr>r%r"r�r�os���&�&�K�
�#��#r%r�c�<�\rSrSr\R67r\S5rSr	g)�LifoQueueJoinTesti�c#�6# �URSS9nURS5 URS5 URUR55 UR	S5 UR	S5 URSUR
55 URSUR5v�5 URSUR
55 URSUR5v�5 URUR55 g7f)Nr(rrrr'r�rIs  r"r0�LifoQueueJoinTest.test_order�s�������Q��'��	���Q��	���Q���������!�	���a��	���a������A�L�L�N�+�����1�5�5�7�]�,�����A�L�L�N�+�����1�5�5�7�]�,�������	�"�r�r>N)68r?r@rArBr�	LifoQueuer�rr0rCr>r%r"r�r��s���"�"�K�
�#��#r%r�c�$�\rSrSr\S5rSrg)�ProducerConsumerTesti�c#�.^^# �[R"SS9m/m[RUU4Sj5n[RU4Sj5nU"5 U"5v� TR	5v� UR[
[S55T5 g7f)Nr'rc3�t># �TRTR5v�5 TR5 M37frP)r�rr�)�historyr s��r"�consumer�=ProducerConsumerTest.test_producer_consumer.<locals>.consumer�s+��������a�e�e�g�
�/����
��s�58c3�X># �[S5HnTRU5v� M g7f)Nrn)r*r)r�r s �r"�producer�=ProducerConsumerTest.test_producer_consumer.<locals>.producer�s"�����b�	���e�e�D�k�!�"�s�'*rn)rrrr�r�r,r�r*)rr�r�r�r s   @@r"�test_producer_consumer�+ProducerConsumerTest.test_producer_consumer�s{�����L�L��#����69
���	�70�	�7172
���	"�73�	"�	�74��j���f�f�h������e�B�i��'�2�s�BBr>N)r?r@rArBrr�rCr>r%r"r�r��s��
�3��3r%r��__main__)rx�datetimerr�unittest�tornadorr�tornado.genr�tornado.testingrr	rrEr�r�r�r�r�r?�mainr>r%r"�<module>r�s��������$�3�2"�]�2"�jb2�=�b2�JB"�=�B"�J6:�M�6:�r#�M�#�$#�
�#�$3�=�3�6�z���M�M�O�r%
codekingpro/portable-devtools · Team Ai