Sindbad~EG File Manager
�
&Μgz#���dZddlmZddlZddlmZddlmZmZddl m
Z
Gd�d�ZGd �d
ej�Z
edk(rejd�
�yy)zTest hyperparser, coverage 98%.�)�HyperParserN)�requires)�Tk�Text)�EditorWindowc�B�eZdZd�Zej
ZejZy)�DummyEditwinc�J�||_d|_d|_d|_d|_y)N��>>>)�2i�i�)�text�indentwidth�tabwidth�prompt_last_line�num_context_lines)�selfrs �?/usr/local/lib/python3.12/idlelib/idle_test/test_hyperparser.py�__init__zDummyEditwin.__init__
s(���� ������
� %���!.���N)�__name__�
__module__�__qualname__rr�_build_char_in_string_func�is_char_in_string�rrr r s!��/�".�!H�!H��$�6�6�rr c�l�eZdZdZed��Zed��Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zy)�HyperParserTestu#"""This is a module docstring"""
# this line is a comment
x = "this is a string"
y = 'this is also a string'
l = [i for i in range(10)]
m = [py*py for # comment
py in l]
x.__len__
z = ((r'asdf')+('a')))
[x for x in
for = False
cliché = "this is a string with unicode, what a cliché"c���td�t�|_|jj�t |j�|_t
|j
�|_y)N�gui)rr�root�withdrawrrr �editwin��clss r�
setUpClasszHyperParserTest.setUpClass%sA������4�������������>���"�3�8�8�,��rc�D�|`|`|jj�|`y)N)rr#r!�destroyr$s r�
tearDownClasszHyperParserTest.tearDownClass-s ���H�c�k��������Hrc�P�|jjd|j�y)N�insert)rr+�code�rs r�setUpzHyperParserTest.setUp3s��� � ����4�9�9�-rc�^�|jjdd�d|j_y)N�1.0�endr)r�deleter#rr-s r�tearDownzHyperParserTest.tearDown6s"��� � �����&�(-����%rc�.�t|j|�S)z>
Return a parser object with index at 'index'
)rr#)r�indexs r�
get_parserzHyperParserTest.get_parser:s���4�<�<��/�/rc�B�|jt�5}|jjddd�|j d�}ddd�|jdt
j��d|j_ |j d�}|j|j|jjdd��|jjd|jjdd�d z�|j d
�}y#1swY��xYw)z6
test corner cases in the init method
�consoler0z1.endz1.5N�precedes�r1�z54.5)�assertRaises�
ValueErrorr�tag_addr6�assertIn�str� exceptionr#r�assertEqual�rawtext�getr+)r�ve�ps r� test_initzHyperParserTest.test_init@s����
�
�z�
*�b��I�I���i���8�����&�A�+�
�
�
�j�#�b�l�l�"3�4�)+����%�
�O�O�E�"��������D�I�I�M�M�%��$?�@�
� � ����� � �
�
�e�U� ;�A� =�>��O�O�F�#��+�
*�s�/D�Dc�>�|j}|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��y)Nr0z1.4z2.3z3.3z3.7z4.6z12.54)r6�assertFalse�is_in_string�
assertTrue�rrDrFs r�test_is_in_stringz!HyperParserTest.test_is_in_stringTs����o�o����J��������)�*���J��������(�)���J��������)�*���J��������)�*���J��������(�)���J��������(�)���L��������(�)rc���|j}|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��|d�}|j|j��y)Nr0z1.1z2.5z3.4z3.6z4.14)r6rK�
is_in_coderIrLs r�test_is_in_codezHyperParserTest.test_is_in_codefs����o�o����J���������'���J���������(���J���������(���J���������'���J���������(���K���������(rc�f�|j}d�}d�}|d�}|j||��|j||��|d�}|j||�d�|j||�||��|d�}|j||�d�|j||�||��|d�}|j||�d �|j||��|d
�}|j||��|j||��y)Nc�&�|jd��S)NF�� mustclose��get_surrounding_brackets��parsers r�without_mustclosezGHyperParserTest.test_get_surrounding_bracket.<locals>.without_mustcloseys���2�2�U�2�C�Crc�&�|jd��S)NTrSrUrWs r�with_mustclosezDHyperParserTest.test_get_surrounding_bracket.<locals>.with_mustclose~s���2�2�T�2�B�Brz3.2z5.6)z5.4�5.25z5.23)z5.21z5.24z6.15)z6.4z6.endz9.end)r6�assertIsNone�assertTupleEqual)rrDrYr[rFs r�test_get_surrounding_bracketz,HyperParserTest.test_get_surrounding_bracketvs!���o�o�� D�
C�
��J�����.��+�,����+�A�.�/���J�����/��2�O�D����/��2�N�1�4E�F���K�����/��2�4D�E����/��2�N�1�4E�F���K�����/��2�4D�E����.��+�,���L�����.��+�,����+�A�.�/rc���|j}|d�}|j|j�d�|d�}|jt�5}|j�ddd�|jdt
j��|d�}|j|j�d�|d�}|j|j�d�|d �}|j|j�d
�|d�}|j|j�d�|d�}|j|j�d
�|d�}|j|j�d�|d�}|jt�5}|j�ddd�|jdt
|j��|d�}|j|j�d
�|d�}|j|j�d
�|d�}|j|j�d
�|d�}|j|j�d
�|d�}|j|j�d�|d�}|j|j�d�y#1swY��kxYw#1swY��-xYw)Nz4.2zy z4.7zis inside a coder\z range(10)z6.7�pyz6.8r:z7.9z8.endz x.__len__z9.13zr'asdf'z9.17z10.0z10.6z10.11z11.3z11.11�Falsez12.6�cliché)r6rB�get_expressionr<r=r?r@rA)rrDrFrEs r�test_get_expressionz#HyperParserTest.test_get_expression�s\���o�o����J������)�)�+�T�2���J��
�
�
�z�
*�b�
����+��
�
�(�#�b�l�l�*;�<���K������)�)�+�[�9���J������)�)�+�T�2���J������)�)�+�R�0���J������)�)�+�T�2���L������)�)�+�[�9���K������)�)�+�Y�7���K��
�
�
�z�
*�b�
����+��
�
�(�#�b�l�l�*;�<���K������)�)�+�R�0���K������)�)�+�R�0���L������)�)�+�R�0���K������)�)�+�R�0���L������)�)�+�W�5���K������)�)�+�Y�7�W+�
*��.+�
*�s�K�K�K�K#c��d�}|j|d��|j|d��|j|d��|j|d��|j|d��|j|d��|j|d��|j|d ��|j|d
��|j|d��|j|d��|j|d
��|j|d��|j|d��|j|d��|j|d��|j|d��|jtjddd�td��|jtjddd�td��|jtjddd�td��|j|d��|j|d��|j|d��|j|d��|j|d��|j|d��|j|d ��|j|d!��y)"Nc��tj|dt|��}|t|�k(ry|dk(rydj|t|��}t |��)NrTFz'Unexpected result: {} (expected 0 or {})r�_eat_identifier�len�format� Exception)� candidate�result�err_msgs r�is_valid_idz8HyperParserTest.test_eat_identifier.<locals>.is_valid_id�sY�� �0�0��A�s�9�~�N�F���Y��'���1���C�J�J��C� �N��� ��(�(r�2notid�valid_id� _valid_id� valid_id_�
_2valid_id�Truerb�None�for�import�return�clichercua٢�2au٢aua²z+ varr��varz+varr;z.var�+� �:�?�^�\�"z
"a string")rIrKrBrrhri)rros r�test_eat_identifierz#HyperParserTest.test_eat_identifier�sG��
)�
����X�.�/�
����J�/�0�����K�0�1�����K�0�1�����L�1�2�
����F�+�,�����G�,�-�����F�+�,�
����U�+�,�����X�.�/�����X�.�/�
����H�-�.�����I�.�/�����E�*�+�
����T�*�+�����U�+�,�����U�+�,�
����4�4�W�a��C�S��Z�P�����4�4�V�Q��B�C��J�O�����4�4�V�Q��B�C��J�O�
����S�)�*�����S�)�*�����S�)�*�����S�)�*�����S�)�*�����T�*�+�����S�)�*�����\�2�3rc ��tj}tdd�D�],}|j|d|zd|�|�|j|d|zd|�|�|j|dd|dz
zzd|�|�|j|dd|dz
zzd|�|�|j|dd|dz
zzd|�|�|j|d|dz
zdzd|�|�|j|d|zd|�d�|j|dd|dz
zzd|�d�|j|dd|dz
zzd|�d���/y)N���ar�é�2r~)rrh�rangerB)r�eat_id�lengths r�#test_eat_identifier_various_lengthsz3HyperParserTest.test_eat_identifier_various_lengthss^���,�,���A�r�l�F����V�C�&�L�!�V�<�f�E����V�D�6�M�1�f�=�v�F����V�C�#��!��*<�$<�a��H�&�Q����V�D�3�&�1�*�+=�$=�q�&�I�6�R����V�D�3�&�1�*�+=�$=�q�&�I�6�R����V�D�F�Q�J�$7�#�$=�q�&�I�6�R����V�C�&�L�!�V�<�a�@����V�C�#��!��*<�$<�a��H�!�L����V�C�$�&�1�*�*=�$=�q�&�I�1�M�#rN)rrrr,�classmethodr&r)r.r3r6rGrMrPr_rer�r�rrrrrsk��
H� ��-��-�����
.�.�0�$�(*�$)� 0�B28�h74�rNrr�__main__�)� verbosity)�__doc__�idlelib.hyperparserr�unittest�test.supportr�tkinterrr�idlelib.editorrr �TestCaserr�mainrrr�<module>r�sU��!�+��!��'� 7� 7�{N�h�'�'�{N�|�z���H�M�M�A��r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists