Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j�#��.�SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK3Jr SSKJ
r
JrJr SSKJr SSKJr \R(S5r"SS\R,5r"S	S4\R,5r"SS\R,5rg)
�N)�utf8)�LogFormatter�define_logging_options�enable_pretty_logging)�OptionParser)�basestring_typec#�# �[R"5 [R"S[S9 Sv� SSS5 g!,(df   g=f7f)N�ignore)�category)�warnings�catch_warnings�simplefilter�BytesWarning���[D:\code\apps\devtools\python\user_packages\Python313\site-packages\tornado/test/log_test.py�ignore_bytes_warningr s/���	�	 �	 �	"����h��>�
�5#�	"�	"�s�A�?�	A�6A
�	Ac�n�\rSrSr\R7"S5rSrSrSr	Sr8SrSrS	r
S9rSrSrg
)�LogFormatterTest�'sD(?s)\[E [0-9]{6} [0-9]{2}:[0-9]{2}:[0-9]{2} log_test:[0-9]+\] (.*)c�B�[SS9Ul[RS0URlSURl[R"S5UlSURl[R"5Ul[RRURS5UlUR!UR5UlUR"R%UR5 URR'UR"5 g)NF)�color��rzlog.out)r�	formatter�logging�ERROR�_colors�_normal�Logger�logger�	propagate�tempfile�mkdtemp�tempdir�os�path�join�filename�make_handler�handler�setFormatter�10addHandler��selfs r�setUp�LogFormatterTest.setUp.s���%�E�2���11#*�-�-��!:�����!)������n�n�%7�8��� %������'�'�)��������T�\�\�9�=��
��(�(����7������!�!�$�.�.�1������t�|�|�,rc��URR5 [R"UR5 [R12"UR5 g�N)r+�closer&�unlinkr)�rmdirr%r.s r�tearDown�LogFormatterTest.tearDown?s2��������13�	�	�$�-�-� �14������rc�,�[R"USS9$)N�utf-8��encoding)r�FileHandler)r/r)s  rr*�LogFormatterTest.make_handlerDs���"�"�8�g�>�>rc�*�[URS5nUR5R5n[R15R
U5nU(aURS5sSSS5 $[SU-5e!,(df   g=f)N�rb�zoutput didn't match regex: %r)	�openr)�read�stripr�LINE_RE�match�group�	Exception)r/�f�line�ms    r�16get_output�LogFormatterTest.get_outputGsl��
�$�-�-��
&�!��6�6�8�>�>�#�D� �(�(�.�.�t�4�A���w�w�q�z�	'�
&� � ?�$� F�G�G�
'�
&�s�AB�6B�17Bc�z�URRS5 URUR5S5 g)N�foosfoo)r!�error�assertEqualrLr.s r�test_basic_logging�#LogFormatterTest.test_basic_loggingPs+�������%� �������*�F�3rc	���[5 URRS5 URUR	5[[
S555 SSS5 g!,(df   g=f)N��)rr!rPrQrLr�reprr.s r�test_bytes_logging�#LogFormatterTest.test_bytes_loggingTsF��
!�
#��K�K���g�&����T�_�_�.��T�'�]�0C�D�$�
#�
#�s�AA"�"18A0c19��[5 URRSR55 SSS5 [	[20[5(a*URUR5[S55 gURUR5[[[S5555 g!,(df   N�=f�N�é)rr!rP�encode�21issubclass�bytesrrQrLrrVr.s r�test_utf8_logging�"LogFormatterTest.test_utf8_loggingZs���
!�
#��K�K���h�o�o�/�0�$��e�_�-�-�
���T�_�_�.��X��?�22
���T�_�_�.��T�$�x�.�5I�0J�K�$�
#�s�*B<�<23C24c���[S5e![a URRS5 Of=fUR5nUR	US5 URSU5 g)NrUzcaught exceptionsException.*\\xe9s\n)rHr!�	exceptionrL�assertRegex�assertNotIn)r/�outputs  r�test_bytes_exception_logging�-LogFormatterTest.test_bytes_exception_logginggsc��	6��G�$�$���	6��K�K�!�!�"4�5�	6�����"������!5�6������(s�
�%5�5c��URRS5 URUR5[	S55 grZ)r!rPrQrLrr.s r�test_unicode_logging�%LogFormatterTest.test_unicode_loggingss/�������(�#�������*�D��N�;r)r)rr+r!r%N)�__name__�25__module__�__qualname__�__firstlineno__�re�compilerEr0r7r*rLrRrWr_rfri�__static_attributes__rrrrr'sE���j�j�W��G�-�"�26?�H�4�E�L�27)�<rrc�:^�\rSrSrU4SjrSrSrSrSrU=r	$)�EnablePrettyLoggingTest�xc��>�[TU]5 [5Ul[	UR5 [28R"S5UlSURlg)Nz-tornado.test.log_test.EnablePrettyLoggingTestF)	�superr0r�optionsrrr r!r")r/�	__class__s �rr0�EnablePrettyLoggingTest.setUpys>���
��
��#�~����t�|�|�,��n�n�%T�U��� %����rc��[R"5nUS-URl[	URUR29S9 UR
S[UR30R55 UR31RS5 UR32RSR5 [R"US-5nUR
S[U55 [USSS9nURUR5S	5 SSS5 UR33RH#nUR5 UR5 M% [R"US-5Hn[ R""U5 M [ R$"U5 g!,(df   N�=f!UR34RH#nUR5 UR5 M% [R"US-5Hn[ R""U5 M [ R$"U5 f=f)35N�	/test_log�rwr!rA�hellor�36/test_log*r:r;�^\[E [^]]*\] hello$)r#r$rw�log_file_prefixrr!rQ�len�handlersrP�flush�globrBrcrCr4r&r5r6�r/�tmpdir�	filenamesrIr+r)s      r�
test_log_file�%EnablePrettyLoggingTest.test_log_file�s����!�!�#��	�+1�K�+?�D�L�L�(�!�$�,�,�t�{�{�K����Q��D�K�K�$8�$8� 9�:��K�K���g�&��K�K� � ��#�)�)�+��	�	�&�<�"7�8�I����Q��I��/��i��l�W�5��� � �����+A�B�6� �;�;�/�/���
�
���
�
��0�!�I�I�f�|�&;�<���	�	�(�#�=��H�H�V��6�5�� �;�;�/�/���
�
���
�
��0�!�I�I�f�|�&;�<���	�	�(�#�=��H�H�V��s%�C$F?�;!F.�F?�.37F<�8F?�?BI38c�^�[R"5nUS-URlSURl[URURS9 URRS5 URRSR5 [R"US-5nURS[U55 [USSS	9nURUR5S395 SSS5 URRH#nUR5 UR!5 M% [R"US-5Hn["R$"U5 M ["R&"U5 g!,(df   N�=f!URRH#nUR5 UR!5 M% [R"US-5Hn["R$"U5 M ["R&"U5 f=f)Nr{�timer|r}rr~rAr:r;r)r#r$rwr��log_rotate_moderr!rPr�r�r�rQr�rBrcrCr4r&r5r6r�s      r�!test_log_file_with_timed_rotating�9EnablePrettyLoggingTest.test_log_file_with_timed_rotating�s����!�!�#��	�+1�K�+?�D�L�L�(�+1�D�L�L�(�!�$�,�,�t�{�{�K��K�K���g�&��K�K� � ��#�)�)�+��	�	�&�<�"7�8�I����Q��I��/��i��l�W�5��� � �����+A�B�6� �;�;�/�/���
�
���
�
��0�!�I�I�f�|�&;�<���	�	�(�#�=��H�H�V��6�5�� �;�;�/�/���
�
���
�
��0�!�I�I�f�|�&;�<���	�	�(�#�=��H�H�V��s%�CF!�!F�>F!�40F�F!�!BH,c��SURlSURlUR[[41URURS9 URRH#nUR5 UR5 M% g!URRH#nUR5 UR5 M% f=f)N�	some_path�42wrong_moder|)43rwr�r��assertRaises�44ValueErrorrr!r�r�r4)r/r+s  r�test_wrong_rotate_mode_value�4EnablePrettyLoggingTest.test_wrong_rotate_mode_value�s���	 �+6�D�L�L�(�+7�D�L�L�(�����%�����{�{�	
�
� �;�;�/�/���
�
���
�
��0��4�;�;�/�/���
�
���
�
��0�s�AB�?C)r!rw)45rkrlrmrnr0r�r�r�rq�
__classcell__)rxs@rrsrsxs���&��(�(
 �
 rrsc�L�\rSrSrSrS
SjrSrSrSrSr	S	r46S47rSrSr
g)�LoggingOptionTest�z?Test the ability to enable and disable Tornado's logging hooks.Nc�<�SnSnSRX1U/5n[R"[RSU/U=(d /-[R48[RS9nUR5upxURURSSU-5 SU;$)	Nz7from tornado.options import options, parse_command_linez%import logging; logging.info("hello")�;z-c)�stdout�stderrrzprocess failed: %rshello)49r(�50subprocess�Popen�sys�51executable�PIPE�STDOUT�communicaterQ�52returncode)	r/�	statement�args�IMPORT�LOG_INFO�program�procr�r�s	         r�logs_present�LoggingOptionTest.logs_present�s���K��:���(�(�F�x�8�9�����
�^�^�T�7�+�t�z�r�:��?�?��$�$�53��54�)�)�+���������!�-A�F�-J�K��6�!�!rc�D�URURS55 g)N�pass��assertFalser�r.s r�test_default�LoggingOptionTest.test_default�s������*�*�6�2�3rc�D�URURS55 g)N�parse_command_line()��55assertTruer�r.s r�test_tornado_default�&LoggingOptionTest.test_tornado_default�s������)�)�*@�A�Brc�H�URURSS/55 g)Nr�z--logging=noner�r.s r�test_disable_command_line�+LoggingOptionTest.test_disable_command_line��"������*�*�+A�DT�CU�V�Wrc�H�URURSS/55 g)Nr�z--logging=Noner�r.s r�*test_disable_command_line_case_insensitive�<LoggingOptionTest.test_disable_command_line_case_insensitive�r�rc�D�URURS55 g)Nz.options.logging = "none"; parse_command_line()r�r.s r�test_disable_code_string�*LoggingOptionTest.test_disable_code_string�s��������N�O�	56rc�D�URURS55 g)N�,options.logging = None; parse_command_line()r�r.s r�test_disable_code_none�(LoggingOptionTest.test_disable_code_none�s��������L�M�	57rc�H�URURSS/55 g)Nr�z--logging=infor�r.s r�test_disable_override�'LoggingOptionTest.test_disable_override�s%��������>�AQ�@R�
�	58rrr3)rkrlrmrn�__doc__r�r�r�r�r�r�r�r�rqrrrr�r��s0��I�"�$4�C�X�X�59�6061�6263rr�)�64contextlibr�rr&ror�r�r#�unittestr�tornado.escaper�tornado.logrrr�tornado.optionsr�tornado.utilr�contextmanagerr�TestCaserrsr�rrr�<module>r�s������	�	��65�����S�S�(�(�������N<�x�(�(�N<�b= �h�/�/�= �@166��)�)�167r
codekingpro/portable-devtools · Team Ai