403Webshell
Server IP : 192.158.238.246  /  Your IP : 52.14.216.203
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib/python3.11/site-packages/tap/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/tap/tests/__pycache__/test_parser.cpython-311.pyc
�

��bg�@����ddlmZddlZddlmZmZddlZddlZddlZddlm	Z	ddl
mZ	ddlZddl
mZdZn
#e$rdZYnwxYwed	���ZGd
�dej��ZdS)�)�contextmanagerN)�BytesIO�StringIO)�mock)�Parser)�peekableTFc#�K�tjddkrt��t��}}nt��t��}}tjtj}}	||ct_t_tjtjfV�||ct_t_dS#||ct_t_wxYw)Nr�)�sys�version_inforr�stdout�stderr)�new_out�new_err�old_out�old_errs    �f/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/tap/tests/test_parser.py�captured_outputrs�����
����Q���"�9�9�g�i�i����#�:�:�x�z�z����z�3�:�W�G�2�!(�'���
�C�J��j�#�*�$�$�$�$�!(�'���
�C�J�J�J���'���
�C�J�1�1�1�1s�+3B9�9Cc���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zejde d����d���Z!dS) �
TestParserzTests for tap.parser.Parserc���t��}|�d��}|�d|j��|�|j��|�|jdu��dS)zThe parser extracts an ok line.z!ok - This is a passing test line.�testN)r�
parse_line�assertEqual�category�
assertTrue�ok�number��self�parser�lines   r�
test_finds_okzTestParser.test_finds_ok%sj������� � �!D�E�E��������/�/�/������ � � ������t�+�,�,�,�,�,�c��t��}|�d��}|�d|j��|�d|j��dS)z"The parser extracts a test number.zok 42 is the magic number.r�*N)rrrrrrs   r�test_finds_numberzTestParser.test_finds_number/sU������� � �!=�>�>��������/�/�/�����T�[�)�)�)�)�)r$c��t��}|�d��}|�d|j��|�d|j��dS)Nzok 42 A passing test.rzA passing test.�rrrr�descriptionrs   r�test_finds_descriptionz!TestParser.test_finds_description8sW������� � �!8�9�9��������/�/�/����*�D�,<�=�=�=�=�=r$c��t��}|�d��}|�d|j��|�d|j��dS)Nz+ok A description # Not part of description.rz
A descriptionr)rs   r�"test_after_hash_is_not_descriptionz-TestParser.test_after_hash_is_not_description@sV������� � �!N�O�O��������/�/�/�����$�*:�;�;�;�;�;r$c��t��}|�d��}|�d|j��|�|j��dS)Nz ok A description # TODO Not doner)rrrrr�todors   r�test_finds_todozTestParser.test_finds_todoHsQ������� � �!C�D�D��������/�/�/�����	�"�"�"�"�"r$c��t��}|�d��}|�d|j��|�|j��dS)Nzok A description # SKIP for nowr�rrrrr�skiprs   r�test_finds_skipzTestParser.test_finds_skipPsQ������� � �!B�C�C��������/�/�/�����	�"�"�"�"�"r$c�.�t��}|�d��}|�d|j��|�|j��|�|jdu��|�d|jj	��dS)z"The parser extracts a not ok line.z%not ok - This is a failing test line.rN�)
rrrr�assertFalserrr�	directive�textrs   r�test_finds_not_okzTestParser.test_finds_not_okXs�������� � �!H�I�I��������/�/�/������!�!�!������t�+�,�,�,�����T�^�0�1�1�1�1�1r$c�h�t��}d}|�|��}|j}|�d|j��|�d|j��|�|j��|�|j	��|�d|j
��dS)zThe parser extracts a directivez/not ok - This line fails # TODO not implementedrzTODO not implementedznot implementedN)rrr8rrr9r7r3rr/�reason)r r!�	test_liner"r8s     r�test_finds_directivezTestParser.test_finds_directivecs�������E�	�� � ��+�+���N�	�������/�/�/����/���@�@�@������(�(�(����	��'�'�'����*�I�,<�=�=�=�=�=r$c��t��}|�d��}|�d|j��dS)z*The parser returns an unrecognizable line.z%This is not a valid TAP line. # srsly�unknownN�rrrrrs   r�test_unrecognizable_linez#TestParser.test_unrecognizable_lineqs=������� � �!H�I�I������D�M�2�2�2�2�2r$c��d}t��}|�|��}|�d|j��|�||j��dS)z&The parser extracts a diagnostic line.z# An example diagnostic line�
diagnosticN)rrrrr9)r r9r!r"s    r�test_diagnostic_linezTestParser.test_diagnostic_lineysY��-������� � ��&�&������t�}�5�5�5�����t�y�)�)�)�)�)r$c��t��}|�d��}|�d|j��|�d|j��dS)z$The parser extracts a bail out line.z%Bail out! This is the reason to bail.�bailzThis is the reason to bail.N)rrrrr<rs   r�test_bail_out_linezTestParser.test_bail_out_line�sV������� � �!H�I�I��������/�/�/����6���D�D�D�D�Dr$c��t��}|�d��}|�d|j��|�d|j��dS)z#The parser extracts a version line.zTAP version 13�version�
N)rrrrrJrs   r�test_finds_versionzTestParser.test_finds_version�sU������� � �!1�2�2������D�M�2�2�2�����T�\�*�*�*�*�*r$c��t��}|�t��5|�d��ddd��dS#1swxYwYdS)z=The TAP spec dictates that anything less than 13 is an error.zTAP version 12N)r�assertRaises�
ValueErrorr)r r!s  r�test_errors_on_old_versionz%TestParser.test_errors_on_old_version�s�������
�
�
�z�
*�
*�	0�	0����.�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s�A�A�Ac��t��}|�d��}|�d|j��|�d|j��dS)z The parser extracts a plan line.z1..42�planr&N)rrrr�expected_testsrs   r�test_finds_planzTestParser.test_finds_plan�sU������� � ��)�)��������/�/�/�����T�0�1�1�1�1�1r$c��t��}|�d��}|�d|j��|�|j��dS)z2The parser extracts a plan line containing a SKIP.z 1..42 # Skipping this test file.rRNr2rs   r�test_finds_plan_with_skipz$TestParser.test_finds_plan_with_skip�sQ������� � �!C�D�D��������/�/�/�����	�"�"�"�"�"r$c��t��}|�d��}|�d|j��dS)z4The parser only recognizes SKIP directives in plans.z1..42 # TODO will not work.r@NrArs   r�-test_ignores_plan_with_any_non_skip_directivez8TestParser.test_ignores_plan_with_any_non_skip_directive�s=������� � �!>�?�?������D�M�2�2�2�2�2r$c�4�tjd��}t��}g}|�|��D]}|�|���|�dt
|����|�d|dj��|�d|dj��|�|dj	��|�d|dj��|�
|dj	��dS)N�H1..2
            ok 1 A passing test
            not ok 2 A failing testr
rRrr��)�inspect�cleandocr�
parse_text�appendr�lenrrrr7)r �sampler!�linesr"s     r�test_parses_textzTestParser.test_parses_text�s���!�
'�
�
��
�������%�%�f�-�-�	�	�D��L�L����������C��J�J�'�'�'������q��!2�3�3�3������q��!2�3�3�3�����a���$�$�$������q��!2�3�3�3�����q���%�%�%�%�%r$c� �tjd��}tjd���}|�|�d����|���t��}g}|�|j	��D]}|�
|���|�dt|����|�d|dj
��|�d|d	j
��|�|d	j��|�|d	j��|�d|d
j
��|�|d
j��dS)NrZF��deletezutf-8r
rRrrr[r\)r]r^�tempfile�NamedTemporaryFile�write�encode�closer�
parse_file�namer`rrarrr�assertIsNone�
yaml_blockr7)r rb�tempr!rcr"s      r�test_parses_filezTestParser.test_parses_file�sa���!�
'�
�
��
�*�%�8�8�8���
�
�6�=�=��)�)�*�*�*��
�
�����������%�%�d�i�0�0�	�	�D��L�L����������C��J�J�'�'�'������q��!2�3�3�3������q��!2�3�3�3�����a���$�$�$����%��(�-�.�.�.������q��!2�3�3�3�����q���%�%�%�%�%r$c�z�tjd��}t��}g}|�|��D]}|�|���t
r�t
jd��}|�dt|����|�d|dj
��|�||dj��|�d|dj��|�
|dj��dS|�d	t|����|�d|dj
��ttdd
����D]#}|�d||j���$|�d|d
j��dS)Nz�TAP version 13
            1..2
            ok 1 A passing test
               ---
               test: sample yaml
               ...
            not ok 2 A failing test�test: sample yaml�rKrr\rr
��r@�r]r^rr_r`�	have_yaml�yaml�	safe_loadrrarJrprro�list�range�r rbr!rcr"�converted_yaml�
line_indexs       r�test_parses_yamlzTestParser.test_parses_yaml�s����!�
'�
�
���������%�%�f�-�-�	�	�D��L�L�������	8�!�^�,D�E�E�N����Q��E�
�
�+�+�+����R��q��!1�2�2�2����^�U�1�X�-@�A�A�A����V�U�1�X�%6�7�7�7����e�A�h�1�2�2�2�2�2����Q��E�
�
�+�+�+����R��q��!1�2�2�2�"�5��A�;�;�/�/�
H�
H�
�� � ��E�*�,=�,F�G�G�G�G����V�U�1�X�%6�7�7�7�7�7r$c� �tjd��}tjd��}t��}g}|�|�|����|�|�|����t
r�|�d|dj��|�d|dj��|�d|dj��|�d	|d
j��|�d|dj��n�|�d|dj��|�d|dj��|�d|dj��|�d	|d
j��|�d|dj��t��}g}|�|�|����|�|�|����t
r�|�d	|dj��|�d|dj��|�d|dj��|�d|d
j��|�d|dj��dS|�d	|dj��|�d|dj��|�d|dj��|�d|d
j��|�d|dj��dS)Nz�TAP version 13
            1..2
            ok 1 A passing version 13 test
               ---
               test: sample yaml
               ...
            not ok 2 A failing version 13 testzV1..2
            ok 1 A passing pre-13 test
            not ok 2 A failing pre-13 testrKrzA passing version 13 testr\zA failing version 13 testr
zA passing pre-13 test�zA failing pre-13 testrw��	r[)	r]r^r�extendr_ryrrJr*)r �sample_version_13�
sample_pre_13r!rcs     r�test_parses_mixedzTestParser.test_parses_mixed�sL��$�,�
2�
�
�� �(�
.�
�
�
�������
���V�&�&�'8�9�9�:�:�:�
���V�&�&�}�5�5�6�6�6��	L����R��q��!1�2�2�2����8�%��(�:N�O�O�O����8�%��(�:N�O�O�O����4�e�A�h�6J�K�K�K����4�e�A�h�6J�K�K�K�K����R��q��!1�2�2�2����8�%��(�:N�O�O�O����8�%��(�:N�O�O�O����4�e�A�h�6J�K�K�K����4�e�A�h�6J�K�K�K�������
���V�&�&�}�5�5�6�6�6�
���V�&�&�'8�9�9�:�:�:��	P����4�e�A�h�6J�K�K�K����4�e�A�h�6J�K�K�K����R��q��!1�2�2�2����8�%��(�:N�O�O�O����8�%��(�:N�O�O�O�O�O����4�e�A�h�6J�K�K�K����4�e�A�h�6J�K�K�K����R��q��!1�2�2�2����8�%��(�:N�O�O�O����8�%��(�:N�O�O�O�O�Or$c�z�tjd��}t��}g}|�|��D]}|�|���t
r�t
jd��}|�dt|����|�d|dj
��|�||dj��|�d|dj��|�
|dj��dS|�d	t|����|�d|dj
��ttdd
����D]#}|�d||j���$|�d|d
j��dS)Nz�TAP version 13
            1..2
            ok 1 A passing test
               ---
               test: sample yaml
            not ok 2 A failing testrtrurKrr\rr
rwr�r@rxr~s       r�test_parses_yaml_no_endz"TestParser.test_parses_yaml_no_end4s����!�
'�
�
���������%�%�f�-�-�	�	�D��L�L�������	8�!�^�,D�E�E�N����Q��E�
�
�+�+�+����R��q��!1�2�2�2����^�U�1�X�-@�A�A�A����V�U�1�X�%6�7�7�7����e�A�h�1�2�2�2�2�2����Q��E�
�
�+�+�+����R��q��!1�2�2�2�"�5��A�;�;�/�/�
H�
H�
�� � ��E�*�,=�,F�G�G�G�G����V�U�1�X�%6�7�7�7�7�7r$c��tjd��}t��}g}|�|��D]}|�|���t
r{t
jd��}|�dt|����|�d|dj
��|�||dj��dS|�dt|����|�d|dj
��ttdd����D]#}|�d	||j���$dS)
Na�TAP version 13
            1..2
            ok 1 A passing test
               ---
               message: test
               severity: fail
               data:
                 got:
                   - foo
                 expect:
                   - bar
               output: |-
                 a multiline string
                 must be handled properly
                 even with | pipes
                 | here > and: therea
               message: test
               severity: fail
               data:
                 got:
                   - foo
                 expect:
                   - bar
               output: "a multiline string\nmust be handled properly\neven with | pipes\n| here > and: there"r
rKrr\��r@)r]r^rr_r`ryrzr{rrarJrpr|r}rr~s       r�test_parses_yaml_more_complexz(TestParser.test_parses_yaml_more_complexQs`���!�
(�
�
��$�������%�%�f�-�-�	�	�D��L�L�������	H�!�^�t�
�
�N�
���Q��E�
�
�+�+�+����R��q��!1�2�2�2����^�U�1�X�-@�A�A�A�A�A����R��U���,�,�,����R��q��!1�2�2�2�"�5��B�<�<�0�0�
H�
H�
�� � ��E�*�,=�,F�G�G�G�G�
H�
Hr$c�v�tjd��}t��}g}|�|��D]}|�|���|�dt
|����|�d|dj��|�|dj	��|�d|dj
��ttdd	����D]#}|�d
||j
���$|�d|d	j
��dS)Nz�TAP version 13
            1..2
            ok 1 A passing test
            # Diagnostic line
               ---
               test: sample yaml
               ...
            not ok 2 A failing testr�rKrr\rDr
rurvr@r)
r]r^rr_r`rrarJrorprr|r}�r rbr!rcr"r�s      r�test_parses_yaml_no_associationz*TestParser.test_parses_yaml_no_associations1���!�
'�	
�	
���������%�%�f�-�-�	�	�D��L�L����������C��J�J�'�'�'�����U�1�X�-�.�.�.����%��(�-�.�.�.�����u�Q�x�'8�9�9�9��u�Q��{�{�+�+�	D�	D�J����Y��j�(9�(B�C�C�C�C������q��!2�3�3�3�3�3r$c�4�tjd��}t��}g}|�|��D]}|�|���|�dt
|����|�d|dj��|�|dj	��ttdd����D]#}|�d||j���$|�d	|dj��dS)
Nz�TAP version 13
            1..2
            ok 1 A passing test
               test: sample yaml
               ...
            not ok 2 A failing testrwrKrr\r
r�r@r)
r]r^rr_r`rrarJrorpr|r}rr�s      r�test_parses_yaml_no_startz$TestParser.test_parses_yaml_no_start�s���!�
'�
�
���������%�%�f�-�-�	�	�D��L�L����������C��J�J�'�'�'�����U�1�X�-�.�.�.����%��(�-�.�.�.��u�Q��{�{�+�+�	D�	D�J����Y��j�(9�(B�C�C�C�C������q��!2�3�3�3�3�3r$c��d|_tjd��}tjd��}t��}g}t	��5\}}|�|��D]}|�|���	ddd��n#1swxYwYt�r
|�dt|����|�d|dj
��t	��5\}}|�|dj��ddd��n#1swxYwY|�d|�
�������|�d|d	j��|�|d	j��dS|�d
t|����|�d|dj
��t!t#d	d����D]#}	|�d||	j���$|�d|dj��|�||�
�������dS)
Nz�TAP version 13
            1..2
            ok 1 A passing test
               ---
               test: sample yaml
               	fail: tabs are not allowed!
               ...
            not ok 2 A failing testz�
WARNING: Optional imports not found, TAP 13 output will be
    ignored. To parse yaml, see requirements in docs:
    https://tappy.readthedocs.io/en/latest/consumers.html#tap-version-13rurKrr\z+Error parsing yaml block. Check formatting.rr
r�rvr@)�maxDiffr]r^rrr_r`ryrrarJrorp�getvalue�striprr|r})
r rb�yaml_errr!rc�	parse_out�_r"�outr�s
          r�test_malformed_yamlzTestParser.test_malformed_yaml�s�������!�
'�	
�	
���#�
L�
�
��������
�
�
�	#�.�9�a��)�)�&�1�1�
#�
#�����T�"�"�"�"�
#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#��	E����Q��E�
�
�+�+�+����R��q��!1�2�2�2� �"�"�
7�h�s�A��!�!�%��(�"5�6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7����=�s�|�|�~�~�?S�?S�?U�?U�
�
�
�
���V�U�1�X�%6�7�7�7����e�A�h�1�2�2�2�2�2����Q��E�
�
�+�+�+����R��q��!1�2�2�2�"�5��A�;�;�/�/�
H�
H�
�� � ��E�*�,=�,F�G�G�G�G����V�U�1�X�%6�7�7�7����X�y�'9�'9�';�';�'A�'A�'C�'C�D�D�D�D�Ds$�1B�B�B�1$D!�!D%�(D%c�"�tjd���}|���t��}g}|�|j��D]}|�|���|�dt|����dS)NFrfr)	rhrirlrrmrnr`rra)r rqr!rcr"s     r�test_parse_empty_filez TestParser.test_parse_empty_file�s����*�%�8�8�8���
�
�����������%�%�d�i�0�0�	�	�D��L�L����������C��J�J�'�'�'�'�'r$ztap.parser.sys.stdinz01..2
ok 1 A passing test
not ok 2 A failing testc�
�t��}g}|���D]}|�|���|�dt	|����|�d|dj��|�d|dj��|�|dj��|�d|dj��|�|dj��dS)Nr
rRrrr[r\)	r�parse_stdinr`rrarrrr7)r r!rcr"s    r�test_parses_stdinzTestParser.test_parses_stdin�s����������&�&�(�(�	�	�D��L�L����������C��J�J�'�'�'������q��!2�3�3�3������q��!2�3�3�3�����a���$�$�$������q��!2�3�3�3�����q���%�%�%�%�%r$N)"�__name__�
__module__�__qualname__�__doc__r#r'r+r-r0r4r:r>rBrErHrLrPrTrVrXrdrrr�r�r�r�r�r�r�r�r�patchrr��r$rrr"s�������%�%�-�-�-�*�*�*�>�>�>�<�<�<�#�#�#�#�#�#�	2�	2�	2�>�>�>�3�3�3�*�*�*�E�E�E�+�+�+�0�0�0�2�2�2�#�#�#�3�3�3�&�&�&�&&�&�&�.8�8�8�<4P�4P�4P�l8�8�8�:,H�,H�,H�\4�4�4�24�4�4�,)E�)E�)E�V	(�	(�	(��T�Z����
�	
�	
���&�&���&�&�&r$r)�
contextlibrr]�iorrrrh�unittestr�
tap.parserrrz�more_itertoolsrry�ImportErrorr�TestCaserr�r$r�<module>r�s��%�%�%�%�%�%����� � � � � � � � �
�
�
�
�����������������������K�K�K�'�'�'�'�'�'��I�I�������I�I�I������
2�
2���
2�V&�V&�V&�V&�V&��"�V&�V&�V&�V&�V&s�9�A�A

Youez - 2016 - github.com/yon3zu
LinuXploit