Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
testing_test.cpython-313.pyc81 linesDownload Raw Back to __pycache__
1�

2��ja*����SSKJrJr SSKJr SSKJr SSKJrJ	r	J3r4Jr SSKJ
r
 SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKr\R.S5r"SS	\	5r"S5S\	5r"SS
\5r"SS\R85r"SS\R85r"SS\R85r"SS\	5r \!S:Xa\RD"5 gg)�)�gen�ioloop)�6HTTPServer)�Event)�AsyncHTTPTestCase�
AsyncTestCase�bind_unused_port�gen_test��ApplicationNc#�$# �[RRU5nU[RU'Sv� Uc[RU	gU[RU'g!Uc[RU	fU[RU'f=f7f�N)�os�environ�get)�name�value�	old_values   �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\tornado/test/testing_test.py�set_environrsp����7�8���t�$�I��B�J�J�t��)�
����9�10�4� �(�B�J�J�t������11�12�4� �(�B�J�J�t��s�3B�A#�)B�#*B
�
Bc� �\rSrSrSrSrSrg)�AsyncTestCaseTest�c���URRnURRU"5S-UR5 UR	5 URRU"5S-UR5 URUR5 UR	SS9 SSS5 URRU"5S-UR5 [SS5 URUR5 UR	5 SSS5 SSS5 g!,(df   N�=f!,(df   N(=f!,(df   g=f)N�{�G�z�?���timeout�ASYNC_TEST_TIMEOUTz0.01)�io_loop�time�add_timeout�stop�wait�assertRaises�failureExceptionr)�selfr!s  r�test_wait_timeout�#AsyncTestCaseTest.test_wait_timeout s����|�|� � ��	
��� � ���$���	�	�:��	�	��	
��� � ���!��T�Y�Y�7�
�
�
�t�4�4�
5��I�I�d�I�#�6�	
��� � ���!��T�Y�Y�7�
�-�v�
6��"�"�4�#8�#8�9��	�	��:�7�
6�6�
5��:�9��7�
6�s0�D.�0E�D?�E�.13D<�?14E
	�	E�15Ec�D�URRURR5S-UR5 UR	SS9 URRURR5S-UR5 UR	SS9 g)zM16This test makes sure that a second call to wait()17clears the first timeout.18g皙�����?rg�������?g�������?N)r r"r!r#r$�r's r�test_subsequent_wait_calls�,AsyncTestCaseTest.test_subsequent_wait_calls2sv��	
��� � ����!2�!2�!4�t�!;�T�Y�Y�G��	�	�#�	��	
��� � ����!2�!2�!4�s�!:�D�I�I�F��	�	�#�	���N)�__name__�19__module__�__qualname__�__firstlineno__r(r-�__static_attributes__r0r/rrrs���$r/rc�.^�\rSrSrU4SjrSrSrU=r$)�LeakTest�@c�L>�[TU]5 [R"5 gr)�super�tearDown�gc�collect�r'�	__class__s �rr;�LeakTest.tearDownAs���
����20�21�22�r/c��^�[5mU4SjnURRU5 URRUR5 UR	5 g)Nc��x># �TR5IShv�N gN![Ra gf=f7fr)r$�asyncio�CancelledError)�events�r�callback�0LeakTest.test_leaked_coroutine.<locals>.callbackMs1����
��j�j�l�"�"���)�)�
��
�s(�:� �� �:� �7�:�7�:)rr �add_callbackr#r$)r'rFrEs  @r�test_leaked_coroutine�LeakTest.test_leaked_coroutineFsD���23���	�	
���!�!�(�+����!�!�$�)�)�,��	�	�r/r0)r1r2r3r4r;rIr5�
__classcell__�r?s@rr7r7@s����24�r/r7c�F^�\rSrSrU4SjrSrSrSrU4SjrSr	U=r25$)�AsyncHTTPTestCaseTest�Xc�>�[TU]5 [5up[5n[	U40UR5D6nUR
U5 X lX@lgr)	r:�setUpr	rr�get_httpserver_options�26add_socket�second_port�
second_server)r'�sock�port�app�serverr?s     �rrQ�AsyncHTTPTestCaseTest.setUpYsO���
��
��%�'�27���m���C�A�4�#>�#>�#@�A�����$����#�r/c��[5$rrr,s r�get_app�AsyncHTTPTestCaseTest.get_appcs28���}�r/c��SnURU5nURURRUR	U55 g)Nz/path)�fetch�assertEqual�request�url�get_url�r'�path�responses   r�test_fetch_segment�(AsyncHTTPTestCaseTest.test_fetch_segmentfs:�����:�:�d�#������)�)�-�-�t�|�|�D�/A�Br/c��SUR-nURU5nURURRU5 g)Nzhttp://127.0.0.1:%d/path)rTr_r`rarbrds   r�test_fetch_full_http_url�.AsyncHTTPTestCaseTest.test_fetch_full_http_urlks>��*�D�,<�,<�<���:�:�d�#������)�)�-�-�t�4r/c�V>�URR5 [TU]
5 gr)rUr#r:r;r>s �rr;�AsyncHTTPTestCaseTest.tearDownss ��������!�
���r/)rTrU)r1r2r3r4rQr\rgrjr;r5rKrLs@rrNrNXs"���$��C�295��r/rNc���\rSrSrSr\R"\R"5S:HS5\R"\	RS:�S5S55rSrS	r
S30rg)�!AsyncTestCaseReturnAssertionsTest�xc��"SS[5nU"S5n[R"5nURU5 UR	[UR5S5 URSURSS5 g)Nc��\rSrSrSrSrg)�JAsyncTestCaseReturnAssertionsTest.test_undecorated_generator.<locals>.Test�~c3�# �Sv� g7frr0r,s r�test_gen�SAsyncTestCaseReturnAssertionsTest.test_undecorated_generator.<locals>.Test.test_gens������r0N)r1r2r3r4rvr5r0r/r�Testrs~s��
r/ryrvr�should be decoratedr�r�unittest�31TestResult�runr`�len�errors�assertIn�r'ry�test�results    r�test_undecorated_generator�<AsyncTestCaseReturnAssertionsTest.test_undecorated_generator}sj��	�=�	��J����$�$�&�����������V�]�]�+�Q�/��
�
�+�V�]�]�1�-=�a�-@�Ar/�PyPyz+pypy destructor warnings cannot be silenced)��z-py312 has its own check for test case returnsc��"SS[5nU"S5n[R"5n[R"5 [R32"S5 UR
U5 SSS5 UR[UR5S5 URSURSS5 g!,(df   NV=f)Nc��\rSrSrSrSrg)�JAsyncTestCaseReturnAssertionsTest.test_undecorated_coroutine.<locals>.Test�c��# �g7frr0r,s r�	test_coro�TAsyncTestCaseReturnAssertionsTest.test_undecorated_coroutine.<locals>.Test.test_coro�s����s�r0N)r1r2r3r4r�r5r0r/rryr��s��
r/ryr��ignorerrzr)rr|r}�warnings�catch_warnings�simplefilterr~r`rr�r�r�s    r�test_undecorated_coroutine�<AsyncTestCaseReturnAssertionsTest.test_undecorated_coroutine�s���	�=�	��K� ���$�$�&���
$�
$�
&��!�!�(�+��H�H�V��'�	
����V�]�]�+�Q�/��
�
�+�V�]�]�1�-=�a�-@�A�'�
&�s�(B:�:33Cc��"SS[5nU"S5n[R"5nURU5 UR	[UR5S5 UR	[UR5S5 g)Nc�D�\rSrSr\R34"S5S5rSrg)�TAsyncTestCaseReturnAssertionsTest.test_undecorated_generator_with_skip.<locals>.Test�zdon't run thisc3�# �Sv� g7frr0r,s rrv�]AsyncTestCaseReturnAssertionsTest.test_undecorated_generator_with_skip.<locals>.Test.test_gen�s����rxr0N)r1r2r3r4r|�skiprvr5r0r/rryr��s��
�]�]�+�
,�
�-�
r/ryrvrr)rr|r}r~r`rr��skippedr�s    r�$test_undecorated_generator_with_skip�FAsyncTestCaseReturnAssertionsTest.test_undecorated_generator_with_skip�sf��	�=�	�35�J����$�$�&�����������V�]�]�+�Q�/�����V�^�^�,�a�0r/c��"SS[5nU"S5n[R"5nURU5 UR	[UR5S5 URSURSS5 g)Nc��\rSrSrSrSrg)�AAsyncTestCaseReturnAssertionsTest.test_other_return.<locals>.Test�c��g)N�*r0r,s r�test_other_return�SAsyncTestCaseReturnAssertionsTest.test_other_return.<locals>.Test.test_other_return�s��r/r0N)r1r2r3r4r�r5r0r/rryr��s��
r/ryr�rz%Return value from test method ignoredrr{r�s    rr��3AsyncTestCaseReturnAssertionsTest.test_other_return�sl��	�=�	��'�(���$�$�&�����������V�]�]�+�Q�/��
�
�=�v�}�}�Q�?O�PQ�?R�Sr/r0N)r1r2r3r4r�r|�skipIf�platform�python_implementation�sys�version_infor�r�r�r5r0r/rroroxsl��36	B��_�_��&�&�(�F�2�5���_�_�	���G�#�7�	�B�
�	�B� 371�	Tr/roc��\rSrSrSrSrg)�SetUpTearDownTest�c��^�/m[R"5n"U4SjS[R5n"U4SjS[U5nU"S5R	U5 /SQnURUT5 g)z�38This test makes sure that AsyncTestCase calls super methods for39setUp and tearDown.40 41InheritBoth is a subclass of both AsyncTestCase and42SetUpTearDown, with the ordering so that the super of43AsyncTestCase will be SetUpTearDown.44c�.>�\rSrSrU4SjrU4SjrSrg)�>SetUpTearDownTest.test_set_up_tear_down.<locals>.SetUpTearDown��c�(>�TRS5 g)NrQ��append�r'�eventss �rrQ�DSetUpTearDownTest.test_set_up_tear_down.<locals>.SetUpTearDown.setUp�s����
�
�g�&r/c�(>�TRS5 g)Nr;r�r�s �rr;�GSetUpTearDownTest.test_set_up_tear_down.<locals>.SetUpTearDown.tearDown�s����
�
�j�)r/r0N)r1r2r3r4rQr;r5�r�s�r�
SetUpTearDownr��s���
'�
*�
*r/r�c�">�\rSrSrU4SjrSrg)�<SetUpTearDownTest.test_set_up_tear_down.<locals>.InheritBoth��c�(>�TRS5 g�Nr�r�r�s �rr��ASetUpTearDownTest.test_set_up_tear_down.<locals>.InheritBoth.test�s����
�
�f�%r/r0N)r1r2r3r4r�r5r�s�r�InheritBothr��s
���
&�
&r/r�r�)rQr�r;N)r|r}�TestCaserr~r`)r'r�r�r��expectedr�s     @r�test_set_up_tear_down�'SetUpTearDownTest.test_set_up_tear_down�sb������$�$�&��	*�H�-�-�	*�	&�-��	&�	�F�����'�0������6�*r/r0N)r1r2r3r4r�r5r0r/rr�r��s��+r/r�c��\rSrSrSrSrg)�"AsyncHTTPTestCaseSetUpTearDownTest��c���[R"5n"SS[5nU"S5nURU5 UR	[US55 UR	[US55 g)Nc� �\rSrSrSrSrSrg)�eAsyncHTTPTestCaseSetUpTearDownTest.test_tear_down_releases_app_and_http_server.<locals>.SetUpTearDown��c��[5$rrr,s rr\�mAsyncHTTPTestCaseSetUpTearDownTest.test_tear_down_releases_app_and_http_server.<locals>.SetUpTearDown.get_app�s45��"�}�$r/c�p�UR[US55 UR[US55 g)N�_app�http_server)�46assertTrue�hasattrr,s rr��jAsyncHTTPTestCaseSetUpTearDownTest.test_tear_down_releases_app_and_http_server.<locals>.SetUpTearDown.test�s(�������f� 5�6������m� <�=r/r0N)r1r2r3r4r\r�r5r0r/rr�r��s��
%�
>r/r�r�r�r�)r|r}rr~�assertFalser�)r'r�r�r�s    r�+test_tear_down_releases_app_and_http_server�NAsyncHTTPTestCaseSetUpTearDownTest.test_tear_down_releases_app_and_http_server�s_���$�$�&��	>�-�	>��V�$������������v�.�/������}�5�6r/r0N)r1r2r3r4r�r5r0r/rr�r��s��7r/r�c�^�\rSrSrU4SjrU4Sjr\S5r\S5rSr	Sr47SrS	rS48r
SrSrS
rSrU=r$)�GenTest��c�0>�[TU]5 SUlg)NF)r:rQ�finishedr>s �rrQ�
GenTest.setUp�s���
��
����
r/c�X>�URUR5 [TU]
5 gr)r�r�r:r;r>s �rr;�GenTest.tearDown�s�������
�
�&�
���r/c��SUlg�NT�r�r,s r�	test_sync�GenTest.test_sync�s	����
r/c#�># �[Rv� SUlg7fr�)r�momentr�r,s r�49test_async�GenTest.test_async�s����j�j����
�s�c���[SS9S5nU"U5 URS5 SUlg![Ra( UR	S[50R"55 NCf=f)Nr+rc3�<# �[R"S5v� g7f�Nr�r�sleepr,s rr��"GenTest.test_timeout.<locals>.test������)�)�A�,�����did not get expected exceptionzgen.sleep(1)T)r51�failr�TimeoutErrorr��	traceback�52format_excr��r'r�s  r�test_timeout�GenTest.test_timeout�sn��	�#�	�	�53�	�54	B���J��I�I�6�7���
���"�"�	B�
�M�M�.�)�*>�*>�*@�A�	B�s�2�9A.�-A.c�@�[SS9S5nU"U5 SUlg)Nrrc3�<# �[R"S5v� g7f)Nr+r�r,s rr��%GenTest.test_no_timeout.<locals>.tests����)�)�C�.� �r�T�r55r�r�s  r�test_no_timeout�GenTest.test_no_timeout
s)��	�!�	�	!�56�	!�	
�T�57���
r/c��[SS9S5n[SS5 U"U5 SSS5 SUlg!,(df   N=f)Ng�?rc3�<# �[R"S5v� g7f)Ng�?r�r,s r�test_long_timeout�DGenTest.test_timeout_environment_variable.<locals>.test_long_timeouts����)�)�D�/�!�r�r�0.1T)r58rr�)r'rs  r�!test_timeout_environment_variable�)GenTest.test_timeout_environment_variablesE��	�#�	�	"�59�	"��-�u�
5��d�#�6���
�6�
5�s	�	5�60Ac���[SS9S5n[SS5 UR[R5 U"U5 SSS5 SSS5 SUlg!,(df   N=f!,(df   N'=f)Nrrc3�<# �[R"S5v� g7fr�r�r,s r�test_short_timeout�HGenTest.test_no_timeout_environment_variable.<locals>.test_short_timeout"r�r�rrT)r61rr%rr�r�)r'r
s  r�$test_no_timeout_environment_variable�,GenTest.test_no_timeout_environment_variable!sg��	�$�	�	�62 �	��-�u�
5��"�"�6�#6�#6�7�"�4�(�8�6���
�8�7��6�
5�s"� A.�	A�A.�63A+	�'A.�.64A<c�<�[S5nU"US5 SUlg)Nc7�T# �URUS5 [Rv� g7f)N�r�)r`rr�)r'�argss  r�test_with_args�5GenTest.test_with_method_args.<locals>.test_with_args.s������T�9�-��*�*��s�&(r�Tr)r'rs  r�test_with_method_args�GenTest.test_with_method_args-s'��	�	�65�	�	�t�V�$���
r/c�8�[S5nU"USS9 SUlg)Nc;�X# �URUSS05 [Rv� g7fr�)�assertDictEqualrr�)r'�kwargss  r�test_with_kwargs�9GenTest.test_with_method_kwargs.<locals>.test_with_kwargs7s$���� � ��&�&�)9�:��*�*��s�(*r�rTr)r'rs  r�test_with_method_kwargs�GenTest.test_with_method_kwargs6s'��	�	�66�	�	��F�+���
r/c�,�[S5nU"U5 g)Nc��# �SUlg7fr�r�r,s rr��+GenTest.test_native_coroutine.<locals>.test@s��� �D�M�s�	)r67r�s  r�test_native_coroutine�GenTest.test_native_coroutine?s��	�	!�68�	!�	
�T�69r/c��[SS9S5nU"U5 URS5 g![Ra70 SUlgf=f)Nr+rc��L# �[R"S5IShv�N gN7fr�r�r,s rr��3GenTest.test_native_coroutine_timeout.<locals>.testHs����)�)�A�,���s�$�"�$r�T)r71r�rr�r�r�s  r�test_native_coroutine_timeout�%GenTest.test_native_coroutine_timeoutFsN��	�#�	�	�72�	�	!���J��I�I�6�7���"�"�	!� �D�M�	!�s�+�A	�A	r�)r1r2r3r4rQr;r73r�r�r�rr	rrrr$r)r5rKrLs@rr�r��sb��������������$�	�74����75!�76!r/r��__main__)#�tornadorr�tornado.httpserverr�
tornado.locksr�tornado.testingrrr	r77�tornado.webrrC�78contextlibr<rr�r�r�r|r��contextmanagerrrr7rNr�ror�r�r�r1�mainr0r/r�<module>r4s����)��X�X�#���	�	��79�������80)��81)��
��B�}��0�-��@?T��(9�(9�?T�D+��)�)�+�:7��):�):�7�$g!�m�g!�T�z���M�M�O�r/