Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_clinic.cpython-312.pyc

�

'Μg�U��R�ddlmZddlmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlZddlZddlZddlZddlZddlZej(d�ej*d�5ddlZdd	lmZddd�d
�Zd�ZGd�d
e
�ZGd�d�ZGd�d�ZGd�d�Zej<dd��ZGd�d�Z Gd�de�Z!Gd�de
�Z"Gd�de
�Z#Gd�d �Z$Gd!�d"�Z%Gd#�d$e
�Z&Gd%�d&e�Z'Gd'�d(e
�Z(	ddl)Z*ejXe*dud)�Gd*�d+ej��Z-Gd,�d-ej�Z.Gd.�d/ej�Z/e0d0k(rejb�yy#1swY��!xYw#e+$rdZ*Y��wxYw)1�)�partial)�support�
test_tools)�	os_helper)�TESTFN�unlink)�dedent)�TestCaseN�clinic)�	DSLParserc�F�|j�|j|�y�N)�clear�update)�
converters�old_converterss  �-/usr/local/lib/python3.12/test/test_clinic.py�restore_dictrs���������n�%�c��|jttjtjj	��|jttj
tj
j	��|jttjtjj	��yr)�
addCleanuprrr�copy�legacy_converters�return_converters)�testcases r�save_restore_convertersrs�������f�&7�&7��)�)�.�.�0�2�����f�&>�&>��0�0�5�5�7�9�����f�&>�&>��0�0�5�5�7�9rc��eZdZdZd�Zd�Zy)�_ParserBaseNc��tj�5}|jt�5||�ddd�ddd�|j	�S#1swY�!xYw#1swYj	�SxYwr)r�captured_stdout�assertRaises�
SystemExit�getvalue)�self�parser�_input�stdouts    r�expect_parser_failurez!_ParserBase.expect_parser_failure)s\��
�
$�
$�
&�&��"�"�:�.��v��/�'���� � �/�.��'���� � �s!�A �	A�A �A	�A � A8c�:�|j|j|�Sr)r(�parse_function)r$r&s  r�parse_function_should_failz&_ParserBase.parse_function_should_fail/s���)�)�$�*=�*=�v�F�Fr)�__name__�
__module__�__qualname__�maxDiffr(r+�rrrr&s���G�!�Grrc��eZdZd�Zy)�
FakeConverterc� �||_||_yr)�name�args�r$r4r5s   r�__init__zFakeConverter.__init__4s����	���	rN)r,r-r.r7r0rrr2r23s��rr2c��eZdZd�Zd�Zy)�FakeConverterFactoryc��||_yr�r4�r$r4s  rr7zFakeConverterFactory.__init__:s	����	rc�.�t|j|�Sr)r2r4)r$r4�default�kwargss    r�__call__zFakeConverterFactory.__call__=s���T�Y�Y��/�/rN)r,r-r.r7r@r0rrr9r99s���0rr9c��eZdZd�Zd�Zy)�FakeConvertersDictc��i|_yr)�used_converters�r$s rr7zFakeConvertersDict.__init__Bs
��!��rc�L�|jj|t|��Sr)rD�
setdefaultr9)r$r4r>s   r�getzFakeConvertersDict.getEs!���#�#�.�.�t�5I�$�5O�P�PrN)r,r-r.r7rHr0rrrBrBAs
��"�QrrB�C�file)�language�filenamec�V�eZdZd�Zd�Zd�Zd�Zd�ZejjZ
y)�
FakeClinicc���t�|_t�|_tjd�|_d|_i|_tjd|j
�|_	tj�|_tj�|_
|t_d|_dx|_|_i|_|j%dd�|j%dd�|j%dd�|j"j&}tjd|d�fd|d�fd	|d�fd
|d�fd|d�fd|d�fd
|d�ff�|_y)N�rN�block�bufferrJ�suppress�docstring_prototype�docstring_definition�methoddef_define�impl_prototype�parser_prototype�parser_definition�impl_definition)rBrrr�	CLanguagerKrL�destination_buffers�BlockParser�block_parser�collections�OrderedDict�modules�classesr4�line_prefix�line_suffix�destinations�add_destinationrH�field_destinations)r$�ds  rr7zFakeClinic.__init__KsD��,�.���!3�!5����(�(��.��
���
�#%�� �"�.�.�r�4�=�=�A���"�.�.�0���"�.�.�0�����
� ��	�.0�0���4�+�������W�h�/����V�X�.����Z��4����!�!��"-�"9�"9�
"�A�j�M�2�
#�Q�w�Z�0�
��7��,�
�q��z�*�
��:��/�
 �!�G�*�-�
��'�
�+�;
�#��rc��|jj|�}|s!tjdt	|�z�|S)NzDestination does not exist: )rerH�sys�exit�repr)r$r4rhs   r�get_destinationzFakeClinic.get_destinationfs6�����!�!�$�'����H�H�3�d�4�j�@�A��rc��||jvr!tjdt|�z�t	j
|||g|���|j|<y)NzDestination already exists: )rerjrkrlr�Destination)r$r4�typer5s    rrfzFakeClinic.add_destinationlsJ���4�$�$�$��H�H�3�d�4�j�@�A�"(�"4�"4�T�4��"M��"M����$�rc��|dk(S)N�moduler0r<s  r�is_directivezFakeClinic.is_directiveqs
���x��rc�"�||j|<yr)�called_directivesr6s   r�	directivezFakeClinic.directivets��'+����t�$rN)r,r-r.r7rmrfrsrvr�Clinic�_module_and_classr0rrrNrNJs.���6�N�
 �,��
�
�7�7�rrNc�r�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�ClinicWholeFileTestc�x�t|�tjtjd�d��|_y)N�test.c�rL)rrrwr[rEs r�setUpzClinicWholeFileTest.setUp{s'����%��m�m�F�$4�$4�T�$:�X�N��rc��t|�j�}|j|jj|�Sr)r	�stripr(r�parse)r$�rawr&s   r�expect_failurez"ClinicWholeFileTest.expect_failures1�����"�"�$���)�)�$�+�+�*;�*;�V�D�Drc���d}|jj|�j�}|dj�}|j	|d�|j|d�y)Nz/*[clinic]
foo
[clinic]*/�z[clinic]*/[clinic]*/z
[clinic]*/)rr��
splitlines�rstrip�assertNotEqual�assertEqual)r$r��cooked�end_lines    r�test_eolzClinicWholeFileTest.test_eol�s[��,�����"�"�3�'�2�2�4���!�9�#�#�%��	
���H�&<�=�����<�0rc�R�d}d}|j|�}|j||�y)Nz�
            /*[clinic input]
            [clinic start generated code]*/
            /*[clinic end generated code: foo]*/
        znError in file "test.c" on line 3:
Mangled Argument Clinic marker line: '/*[clinic end generated code: foo]*/'
�r�r��r$r��msg�outs    r�test_mangled_marker_linez,ClinicWholeFileTest.test_mangled_marker_line�s6����
\�	��!�!�#�&������c�"rc�R�d}d}|j|�}|j||�y)Nz�
            /*[clinic input]
            [clinic start generated code]*/
            /*[clinic end generated code: output=0123456789abcdef input=fedcba9876543210]*/
        zkError in file "test.c" on line 3:
Checksum mismatch!
Expected: 0123456789abcdef
Computed: da39a3ee5e6b4b0d
�r��assertInr�s    r�test_checksum_mismatchz*ClinicWholeFileTest.test_checksum_mismatch�s3����
+�	��!�!�#�&���
�
�c�3�rc�R�d}d}|j|�}|j||�y)Nz_
            /*[clinic input]
            [clinic start generated code]*/foobarfoobar!
        zKError in file "test.c" on line 2:
Garbage after stop line: 'foobarfoobar!'
r�r�s    r�test_garbage_after_stop_linez0ClinicWholeFileTest.test_garbage_after_stop_line�s5����

9�	��!�!�#�&������c�"rc�R�d}d}|j|�}|j||�y)NzS
            /*[clinic input]
             [clinic start generated code]*/
        zuError in file "test.c" on line 2:
Whitespace is not allowed before the stop line: ' [clinic start generated code]*/'
r�r�s    r� test_whitespace_before_stop_linez4ClinicWholeFileTest.test_whitespace_before_stop_line�s6����

c�	��!�!�#�&������c�"rc�0�tjd�}d|_d|_d|_tj
|d��}t
d�j�}|j|�}t
d�j�}|j||�y)Nz//z//[{dsl_name} start]z//[{dsl_name} stop]r|r}z\
            //[clinic start]
            //module test
            //[clinic stop]
        z�
            //[clinic start]
            //module test
            //
            //[clinic stop]
            /*[clinic end generated code: output=da39a3ee5e6b4b0d input=65fab8adff58cf08]*/
        )rr[�body_prefix�
start_line�	stop_linerwr	r�r��lstripr�)r$�clang�clr�r��expecteds      r�test_parse_with_body_prefixz/ClinicWholeFileTest.test_parse_with_body_prefix�s���� � ��&�� ���1���/���
�]�]�5�8�
4����
��U�W�		�
�h�h�s�m����
��V�X�
	�	
����h�'rc�R�d}d}|j|�}|j||�y)NzR
            /* start
            /* nested
            */
            */
        z8Error in file "test.c" on line 2:
Nested block comment!
r�r�s    r�*test_cpp_monitor_fail_nested_block_commentz>ClinicWholeFileTest.test_cpp_monitor_fail_nested_block_comment�s5����
&�	��!�!�#�&������c�"rc�R�d}d}|j|�}|j||�y)Nz<
            #if
            a()
            #endif
        zLError in file "test.c" on line 1:
Invalid format for #if line: no argument!
r�r�s    r�*test_cpp_monitor_fail_invalid_format_noargz>ClinicWholeFileTest.test_cpp_monitor_fail_invalid_format_noarg�s5����
:�	��!�!�#�&������c�"rc�R�d}d}|j|�}|j||�y)NzC
            #ifdef A B
            a()
            #endif
        zbError in file "test.c" on line 1:
Invalid format for #ifdef line: should be exactly one argument!
r�r�s    r�0test_cpp_monitor_fail_invalid_format_toomanyargszDClinicWholeFileTest.test_cpp_monitor_fail_invalid_format_toomanyargs�s6����
P�	��!�!�#�&������c�"rc�R�d}d}|j|�}|j||�y)Nz#elsezQError in file "test.c" on line 1:
#else without matching #if / #ifdef / #ifndef!
r�r�s    r�$test_cpp_monitor_fail_no_matching_ifz8ClinicWholeFileTest.test_cpp_monitor_fail_no_matching_ifs3����
?�	��!�!�#�&������c�"rc�N�|jd�}d}|j||�y)Nzy
            /*[clinic input]
            output preset nosuchpreset
            [clinic start generated code]*/
        zUnknown preset 'nosuchpreset'r��r$r�r�s   r�$test_directive_output_unknown_presetz8ClinicWholeFileTest.test_directive_output_unknown_presets,���!�!�#�
��
.���
�
�c�3�rc�N�|jd�}d}|j||�y)Nzi
            /*[clinic input]
            output pop
            [clinic start generated code]*/
        z"Can't 'output pop', stack is emptyr�r�s   r�test_directive_output_cant_popz2ClinicWholeFileTest.test_directive_output_cant_pops,���!�!�#�
��
3���
�
�c�3�rc��td�}|jj|�}|j|j	td���hd�}|D]/}|j|��5|j
||�ddd��1|j�jd�d}|j|j	d��y#1swY�~xYw)Nz~
            /*[clinic input]
            output print 'I told you once.'
            [clinic start generated code]*/
        >
�cpp_if�	cpp_endifrWrZrV�methoddef_ifndefrXrYrTrU)�field�
���z%/*[clinic end generated code: output=)	r	rr��
assertTrue�
startswith�subTestr�r��split)r$r�r��fieldsr��	last_lines      r�test_directive_output_printz/ClinicWholeFileTest.test_directive_output_print s�����
��
�k�k����$��	
������v�/�(
��	�

���E����E��*��
�
�e�S�)�+�*���J�J�L�&�&�t�,�R�0�	����� � �!H�I�	
�+�*�s�+C�C	c�N�|jd�}d}|j||�y)Nz
            /*[clinic input]
            destination buffer nosuchcommand
            [clinic start generated code]*/
        z+unknown destination command 'nosuchcommand'r�r�s   r� test_unknown_destination_commandz4ClinicWholeFileTest.test_unknown_destination_commandCs,���!�!�#�
��
<���
�
�c�3�rc�N�|jd�}d}|j||�y)Na�
            /*[python input]
            class Custom_converter(CConverter):
                converter = "some_c_function"
                def converter_init(self):
                    self.function.noaccess
            [python start generated code]*/
            /*[clinic input]
            module test
            test.fn
                a: Custom
            [clinic start generated code]*/
        z{Stepped on a land mine, trying to access attribute 'noaccess':
Don't access members of self.function inside converter_init!r�r�s   r�+test_no_access_to_members_in_converter_initz?ClinicWholeFileTest.test_no_access_to_members_in_converter_initLs2���!�!�#�
��
K�	�	
�
�
�c�3�rN)r,r-r.r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r0rrrzrzzsZ��O�E�1�"#�
 �
#�
#�(�*#�#�#�#� � �!
�F � rrzc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�ClinicGroupPermuterTestc�V�tj|||�}|j||�yr)r�permute_optional_groupsr�)r$�l�m�r�output�computeds      r�_testzClinicGroupPermuterTest._testbs&���1�1�!�Q��:�������*rc�6�|jdggdgdggd�y)N�start�stop�step))r�)r�r�)r�r�r��r�rEs r�
test_rangez"ClinicGroupPermuterTest.test_rangefs#���
�
�W�I�;���F�8�*��	
rc�8�|jddggdgdggd�y)N�x�y�ch�attr))r�)r�r�)r�r�r�)r�r�r�r�r�rEs r�test_add_windowz'ClinicGroupPermuterTest.test_add_windowns%���
�
�S�#�J�<�$��6�(���	
rc�F�|jgd�ddggdgddggd�gd�y)	N)�a1�a2�a3�b1�b2�c1�d1�d2)�e1�e2�e3))r�)r�r�r�)r�r�r�r�r�)r�r�r�r�r�r�)r�r�r�r�r�r�r�r�)r�r�r�r�r�r�r�r�r�r�r�r�rEs r�test_ludicrousz&ClinicGroupPermuterTest.test_ludicrousws/���
�
�&��t��5��v��t��N`�?a��	
rc�8�|jggdgdgdggd�y)N�a�b�c)r0�r��r�r��r�r�r�r�rEs r�test_right_onlyz'ClinicGroupPermuterTest.test_right_only�s&���
�
�2�r�S�E�3�%���.��	
rc�6�d�}|jt|�y)Nc�4�tjdggg�y)Nr�)rr�r0rr�fnzPClinicGroupPermuterTest.test_have_left_options_but_required_is_empty.<locals>.fn�s���*�*�C�5�"�b�9r)r!�
ValueError�r$r�s  r�,test_have_left_options_but_required_is_emptyzDClinicGroupPermuterTest.test_have_left_options_but_required_is_empty�s��	:����*�b�)rN)	r,r-r.r�r�r�r�r�r�r0rrr�r�as ��+�
�
�	
�
�*rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�ClinicLinearFormatTestc�T�tj|fi|��}|j||�yr)r�
linear_formatr�)r$�inputr�r?r�s     rr�zClinicLinearFormatTest._test�s'���'�'��8��8�������*rc�(�|jdd�y)NrPr�rEs r�test_empty_stringsz)ClinicLinearFormatTest.test_empty_strings�s���
�
�2�r�rc�(�|jdd�y)Nr�r�rEs r�test_solo_newlinez(ClinicLinearFormatTest.test_solo_newline�s���
�
�4��rc�(�|jdd�y)Nz
          abc
        r�rEs r�test_no_substitutionz+ClinicLinearFormatTest.test_no_substitution�s���
�
���	
rc�,�|jddd��y)N�6
          abc
          {name}
          def
        z%
          abc
          def
        rPr;r�rEs r�test_empty_substitutionz.ClinicLinearFormatTest.test_empty_substitution�s"���
�
����	�	rc�,�|jddd��y)Nrz6
          abc
          GARGLE
          def
        �GARGLEr;r�rEs r�test_single_line_substitutionz4ClinicLinearFormatTest.test_single_line_substitution�s"���
�
����	�	rc�,�|jddd��y)NrzH
          abc
          bingle
          bungle

          def
        zbingle
bungle
r;r�rEs r�test_multiline_substitutionz2ClinicLinearFormatTest.test_multiline_substitution�s"���
�
���%�	�
	&rN)
r,r-r.r�r�r�r�rrrr0rrr�r��s%��+���
��	�&rr�c��eZdZd�Zd�Zy)�InertParserc��yrr0�r$rs  rr7zInertParser.__init__����rc��yrr0�r$rQs  rr�zInertParser.parse�rrN�r,r-r.r7r�r0rrrr�s��
�
rrc��eZdZd�Zd�Zy)�
CopyParserc��yrr0r
s  rr7zCopyParser.__init__�rrc�&�|j|_yr)r�r�r
s  rr�zCopyParser.parse�s
���{�{��rNrr0rrrr�s��
�#rrc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�ClinicBlockParserTestc�H�tjd�}ttj||��}tj|�}|D]}|j|��|jj�}||k(s"Jdt|�zdzt|�z��y)Nzoutput != input!

output z	

 input )	rr[�listr]�BlockPrinter�print_block�fr#rl)r$r�r�rK�blocks�writerrQs       rr�zClinicBlockParserTest._test�s����#�#�D�)���f�(�(���9�:���$�$�X�.���E����u�%�����"�"�$�����j� =��V�� L�}� \�_c�di�_j� j�j�rc�&�|j||�Srr�)r$r�s  r�
round_tripz ClinicBlockParserTest.round_trip�s���z�z�%��'�'rc�&�|jd�y)Nz@
            verbatim text here
            lah dee dah
        �rrEs r�test_round_trip_1z'ClinicBlockParserTest.test_round_trip_1�s������	
rc�&�|jd�y)Nz�
    verbatim text here
    lah dee dah
/*[inert]
abc
[inert]*/
def
/*[inert checksum: 7b18d017f89f61cf17d47f92749ea6930a3f1deb]*/
xyz
rrEs r�test_round_trip_2z'ClinicBlockParserTest.test_round_trip_2�s�����	�		rc��tjd�}tj|d��}t|�|jd<t|�|jd<|j
|�}|j||�y)NrJr}�inertr)rr[rwr�parsersrr�r�)r$r�r�rKr�r�s      r�_test_clinicz"ClinicBlockParserTest._test_clinic�sc���#�#�D�)���M�M�(�V�4��(��^��	�	�'��&�q�M��	�	�&���7�7�5�>�������*rc�(�|jdd�y)Nz�
    verbatim text here
    lah dee dah
/*[copy input]
def
[copy start generated code]*/
abc
/*[copy end generated code: output=03cfd743661f0797 input=7b18d017f89f61cf]*/
xyz
z�
    verbatim text here
    lah dee dah
/*[copy input]
def
[copy start generated code]*/
def
/*[copy end generated code: output=7b18d017f89f61cf input=7b18d017f89f61cf]*/
xyz
)r&rEs r�
test_clinic_1z#ClinicBlockParserTest.test_clinic_1�s�����	�	�	rN)	r,r-r.r�rr r"r&r(r0rrrr�s!��k�(�
�

�+�rrc�p�eZdZd�Zd�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�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d=d:�Z<d;�Z=y<)>�ClinicParserTestc��|jt|d��|j|jj	�t|�j	��y)N�	docstring)r��hasattrr�r,r�r	)r$r�r�s   r�checkDocstringzClinicParserTest.checkDocstringsC�������K�0�1�������+�+�-���)�/�/�1�	3rc��tt��}tjd�}|j	|�|j
\}}|j
d|j�|j
d|j�y)Nz5
            module os
            os.access
        �access�os)rrNr�Blockr��
signaturesr�r4)r$r%rQrr�functions     r�test_trivialzClinicParserTest.test_trivialsg���:�<�(������
��	���U�� �+�+��������8�=�=�1�����v�{�{�+rc���|jtd��}|j\}}|jd|j�|jd|j�y)NzC
            #
            module os
            os.access
        r0r1)r�r	r3r�r4)r$rQrrr4s    r�test_ignore_linez!ClinicParserTest.test_ignore_line"sV���
�
�6�#�
���
!�+�+��������8�=�=�1�����v�{�{�+rc�R�|jd�}|jd|j�|jdt|j��|jd}|jd|j�|j|jtj�y)NzO
            module os
            os.access
                path: int
        r0r��path)	r*r�r4�len�
parameters�assertIsInstance�	converterr�
int_converter�r$r4�ps   r�
test_paramzClinicParserTest.test_param,s����&�&�(�
��
	
����8�=�=�1�����C�� 3� 3�4�5�����'���������(����a�k�k�6�+?�+?�@rc�|�|jd�}|jd}|jd|j�y)Nzb
            module os
            os.access
                follow_symlinks: bool = True
        �follow_symlinksT�r*r;r�r>r?s   r�test_param_defaultz#ClinicParserTest.test_param_default8s>���&�&�(�
��

��� 1�2������q�y�y�)rc�|�|jd�}|jd}|jd|j�y)Nz�
            module os
            os.access
                follow_symlinks: \
                bool \
                = \
                True
        rCTrDr?s   r�test_param_with_continuationsz.ClinicParserTest.test_param_with_continuationsAs>���&�&�(�
��
��� 1�2������q�y�y�)rc�.�|jd�}|jd}|jtj|j
�|jd|jj�d}|jd�}|j||�y)Nz�
            module os
            os.access
                follow_symlinks: int(c_default='MAXSIZE') = sys.maxsize
            rC�MAXSIZEz~Error on line 0:
When you specify a named constant ('sys.maxsize') as your default value,
you MUST specify a valid c_default.
zh
            module os
            os.access
                follow_symlinks: int = sys.maxsize
        )	r*r;r�rj�maxsizer>r=�	c_defaultr+)r$r4r@�expected_msgr�s     r�test_param_default_expressionz.ClinicParserTest.test_param_default_expressionMs����&�&�(���

��� 1�2��������a�i�i�0�����A�K�K�$9�$9�:�
4�	�
�-�-�/�
��
	
����l�+rc���|jd�}|jdt|j��|jdj}|j|tj�y)Nz�
            module os
            os.access
                follow_symlinks: bool = True
                something_else: str = ''
        ��something_else)r*r�r:r;r=r<r�
str_converter)r$r4�convs   r�test_param_no_docstringz(ClinicParserTest.test_param_no_docstringcsa���&�&�(�
��	
����C�� 3� 3�4�5��"�"�#3�4�>�>�����d�F�$8�$8�9rc�N�d}|jd�}|j||�y)NzoError on line 0:
Can't have a parameter without a default ('something_else')
after a parameter with a default!
z}
            module os
            os.access
                follow_symlinks: bool = True
                something_else: str�r+r��r$rLr�s   r�*test_param_default_parameters_out_of_orderz;ClinicParserTest.test_param_default_parameters_out_of_orderns5��
2�	�
�-�-�/'�(��
	
����l�+rc��|jd�}|jd}|jd|jjd�y)Nz^
            module os
            os.access
                path: path_t(allow_fd=1)
        r9��allow_fd)r*r;r�r=r5r?s   r�!disabled_test_converter_argumentsz2ClinicParserTest.disabled_test_converter_arguments{sH���&�&�(�
��

����'������A�K�K�,�,�Z�8�9rc�J�|jd�}|j|d�y)Nz�
            module os
            os.stat as os_stat_fn

               path: str
                   Path to be examined

            Perform a stat system call on the given path.
        z�
            stat($module, /, path)
            --

            Perform a stat system call on the given path.

              path
                Path to be examined
        �r*r.�r$r4s  r�test_function_docstringz(ClinicParserTest.test_function_docstring��.���&�&�(�
��	
���H�'�	
rc�\�|jtd��}|j|d�y)Nz�
            module foo
            foo.bar
              x: int
                 Documentation for x.
              y: int

            This is the documentation for foo.

            Okay, we're done here.
        z�
            bar($module, /, x, y)
            --

            This is the documentation for foo.

              x
                Documentation for x.

            Okay, we're done here.
        �r*r	r.r^s  r�%test_explicit_parameters_in_docstringz6ClinicParserTest.test_explicit_parameters_in_docstring�s5���&�&�v�
/�
(
�
��	
���H�
'�
	
rc�\�|jtd��}|j|d�y)Nzt
            module os
            os.stat
                path: str
            This/used to break Clinic!
        zc
            stat($module, /, path)
            --

            This/used to break Clinic!
        rbr^s  r�Ttest_parser_regression_special_character_in_parameter_column_of_docstring_first_linezeClinicParserTest.test_parser_regression_special_character_in_parameter_column_of_docstring_first_line�s5���&�&�v�/�(
���	
���H�'�	
rc�^�|jd�}|jd|j�y)NzA
            module os
            os.stat as os_stat_fn
        �
os_stat_fn)r*r��
c_basenamer^s  r�test_c_namezClinicParserTest.test_c_name�s/���&�&�(�
��	
����x�':�':�;rc�z�|jd�}|j|jtj�y)Nz:
            module os
            os.stat -> int
        )r*r<�return_converterr�int_return_converterr^s  r�test_return_converterz&ClinicParserTest.test_return_converter�s5���&�&�(�
��	
���h�7�7��9T�9T�Urc���|jd�}|jd}|jtjj
|j�|jd|j�y)Nzt
            module os
            os.access
                *
                follow_symlinks: bool = True
        rCr)r*r;r��inspect�	Parameter�KEYWORD_ONLY�kind�groupr?s   r�	test_starzClinicParserTest.test_star�s^���&�&�(�
��
��� 1�2������*�*�7�7����@�����A�G�G�$rc�|�|jd�}|jd}|jd|j�y)Nz�
            module window
            window.border
                [
                ls: int
                ]
                /
        �lsrY)r*r;r�rsr?s   r�
test_groupzClinicParserTest.test_group�s=���&�&�(�
��
����%������A�G�G�$rc�p�|jd�}d}|D]�\}}|j||��5|j|}|j|j|�|j|j
tjj�ddd���|j|d�y#1swY��xYw)Na�
            module curses
            curses.addch
                [
                y: int
                    Y-coordinate.
                x: int
                    X-coordinate.
                ]
                ch: char
                    Character to add.
                [
                attr: long
                    Attributes for the character.
                ]
                /
        ))r�r�)r�r��r�r)r�rY�r4rsa
            addch([y, x,] ch, [attr])


              y
                Y-coordinate.
              x
                X-coordinate.
              ch
                Character to add.
              attr
                Attributes for the character.
        �
r*r�r;r�rsrrrorp�POSITIONAL_ONLYr.�r$r4�datasetr4rsr@s      r�test_left_groupz ClinicParserTest.test_left_group�s����&�&�(�
��"
��
#�K�D�%����4�u��5��'�'��-��� � ����%�0�� � �����):�):�)J�)J�K�6�5�#�
	
���H�'�	
�	6�5���A B,�,B5	c�p�|jd�}d}|D]�\}}|j||��5|j|}|j|j|�|j|j
tjj�ddd���|j|d�y#1swY��xYw)Na�
            module curses
            curses.imaginary
               [
               [
               y1: int
                 Y-coordinate.
               y2: int
                 Y-coordinate.
               ]
               x1: int
                 X-coordinate.
               x2: int
                 X-coordinate.
               ]
               ch: char
                 Character to add.
               [
               attr1: long
                 Attributes for the character.
               attr2: long
                 Attributes for the character.
               attr3: long
                 Attributes for the character.
               [
               attr4: long
                 Attributes for the character.
               attr5: long
                 Attributes for the character.
               attr6: long
                 Attributes for the character.
               ]
               ]
               /
        ))�y1���)�y2r�)�x1r�)�x2r�ry)�attr1rY)�attr2rY)�attr3rY)�attr4r�)�attr5r�)�attr6r�rza�
            imaginary([[y1, y2,] x1, x2,] ch, [attr1, attr2, attr3, [attr4, attr5,
                      attr6]])


              y1
                Y-coordinate.
              y2
                Y-coordinate.
              x1
                X-coordinate.
              x2
                X-coordinate.
              ch
                Character to add.
              attr1
                Attributes for the character.
              attr2
                Attributes for the character.
              attr3
                Attributes for the character.
              attr4
                Attributes for the character.
              attr5
                Attributes for the character.
              attr6
                Attributes for the character.
        r{r}s      r�test_nested_groupsz#ClinicParserTest.test_nested_groups
s����&�&�"(�"
��F
��#�K�D�%����4�u��5��'�'��-��� � ����%�0�� � �����):�):�)J�)J�K�6�5�#�	
���H�'�	
�6�5�r�c��tj�5}|jt�5|j	|�ddd�ddd�|j�S#1swY�!xYw#1swYj�SxYwr)rr r!r"r*r#)r$�sr's   rr+z+ClinicParserTest.parse_function_should_fail[sc��
�
$�
$�
&�&��"�"�:�.��#�#�A�&�/�'���� � �/�.��'���� � �s!�A)�A�A)�A&	�"A)�)Bc�N�d}|jd�}|j||�y)NzpError on line 0:
Function two_top_groups_on_left has an unsupported group configuration. (Unexpected state 2.b)
z�
            module foo
            foo.two_top_groups_on_left
                [
                group1 : int
                ]
                [
                group2 : int
                ]
                param: int
        rUrVs   r�0test_disallowed_grouping__two_top_groups_on_leftzAClinicParserTest.test_disallowed_grouping__two_top_groups_on_leftas5��
6�	�
�-�-�
/�

��	
����l�+rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.two_top_groups_on_right
                param: int
                [
                group1 : int
                ]
                [
                group2 : int
                ]
        z_Function two_top_groups_on_right has an unsupported group configuration. (Unexpected state 6.b)�r+r�r�s   r�1test_disallowed_grouping__two_top_groups_on_rightzBClinicParserTest.test_disallowed_grouping__two_top_groups_on_rightt�1���-�-�
/�

��
4�	�	
�
�
�c�3�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.parameter_after_group_on_right
                param: int
                [
                [
                group1 : int
                ]
                group2 : int
                ]
        zfFunction parameter_after_group_on_right has an unsupported group configuration. (Unexpected state 6.a)r�r�s   r�8test_disallowed_grouping__parameter_after_group_on_rightzIClinicParserTest.test_disallowed_grouping__parameter_after_group_on_right�r�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.group_after_parameter_on_left
                [
                group2 : int
                [
                group1 : int
                ]
                ]
                param: int
        zeFunction group_after_parameter_on_left has an unsupported group configuration. (Unexpected state 2.b)r�r�s   r�7test_disallowed_grouping__group_after_parameter_on_leftzHClinicParserTest.test_disallowed_grouping__group_after_parameter_on_left�r�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.empty_group
                [
                [
                ]
                group2 : int
                ]
                param: int
        �XFunction empty_group has an empty group.
All groups must contain at least one parameter.r�r�s   r�-test_disallowed_grouping__empty_group_on_leftz>ClinicParserTest.test_disallowed_grouping__empty_group_on_left��1���-�-�	/�	
��
>�	�	
�
�
�c�3�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.empty_group
                param: int
                [
                [
                ]
                group2 : int
                ]
        r�r�r�s   r�.test_disallowed_grouping__empty_group_on_rightz?ClinicParserTest.test_disallowed_grouping__empty_group_on_right�r�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.empty_group
                param: int
                ]
                group2: int
                ]
        z2Function empty_group has a ] without a matching [.r�r�s   r�-test_disallowed_grouping__no_matching_bracketz>ClinicParserTest.test_disallowed_grouping__no_matching_bracket�s-���-�-�/�
��C���
�
�c�3�rc��|jd�}|jd|j�|jdt|j��y)NzL
            module foo
            foo.bar

            Docstring

        zbar($module, /)
--

DocstringrY�r*r�r,r:r;r^s  r�test_no_parametersz#ClinicParserTest.test_no_parameters�sK���&�&�(�
��	
���;�X�=O�=O�P�����C�� 3� 3�4�5rc��|jddd��}|jd|j�|jdt|j��y)Nz�
            module foo
            class foo.Bar "unused" "notneeded"
            foo.Bar.__init__

            Docstring

        rOr���signatures_in_block�function_indexzBar()
--

DocstringrYr�r^s  r�test_init_with_no_parametersz-ClinicParserTest.test_init_with_no_parameters�sW���&�&�(�"#�1�'�6��	
���1�8�3E�3E�F�����C�� 3� 3�4�5rc�N�|jd�}d}|j||�y)NzM
            module foo
            foo.bar => int
                /
        z%Illegal function name: foo.bar => intr�r�s   r�test_illegal_module_linez)ClinicParserTest.test_illegal_module_line�s,���-�-�/�
��
6���
�
�c�3�rc�N�|jd�}d}|j||�y)NzM
            module foo
            foo.bar as 935
                /
        zIllegal C basename: 935r�r�s   r�test_illegal_c_basenamez(ClinicParserTest.test_illegal_c_basename�s,���-�-�/�
��
(���
�
�c�3�rc�J�|jd�}|jd|�y)NzX
            module foo
            foo.bar
                *
                *
        z%Function bar uses '*' more than once.r��r$r�s  r�test_single_starz!ClinicParserTest.test_single_stars(���-�-�/�
��	
�
�
�=�s�Crc��d}d}|D]@}|j|��5|j|�}|j||�ddd��By#1swY�MxYw)N)zmodule foo
foo.bar
  *z&module foo
foo.bar
  *
Docstring here.z"module foo
foo.bar
  this: int
  *z-module foo
foo.bar
  this: int
  *
Docstring.z=Function bar specifies '*' without any parameters afterwards.�rQ)r�r+r�)r$r~r�rQr�s     r�#test_parameters_required_after_starz4ClinicParserTest.test_parameters_required_after_star
sV��
��N���E����E��*��5�5�e�<���
�
�c�3�'�+�*��*�*���$A�A	c�N�|jd�}d}|j||�y)NzX
            module foo
            foo.bar
                /
                /
        �KFunction bar has an unsupported group configuration. (Unexpected state 0.d)r�r�s   r�test_single_slashz"ClinicParserTest.test_single_slash�1���-�-�/�
��
%�	�	
�
�
�c�3�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.bar
                a: int
                /
                b: int
                /
        z%Function bar uses '/' more than once.r�r�s   r�test_double_slashz"ClinicParserTest.test_double_slash's,���-�-�/�
��6���
�
�c�3�rc�N�|jd�}d}|j||�y)Nz�
            module foo
            foo.bar
               x: int
               y: int
               *
               z: int
               /
        zUFunction bar mixes keyword-only and positional-only parameters, which is unsupported.r�r�s   r�test_mix_star_and_slashz(ClinicParserTest.test_mix_star_and_slash3s1���-�-�/�
��
$�	�	
�
�
�c�3�rc�N�|jd�}d}|j||�y)Nz]
            module foo
            foo.bar
                /
                x: int
        r�r�r�s   r�1test_parameters_not_permitted_after_slash_for_nowzBClinicParserTest.test_parameters_not_permitted_after_slash_for_nowCr�rc�N�d}|jd�}|j||�y)Nz#Error on line 0:
Too many var args
zt
            module foo
            foo.bar
               *vararg1: object
               *vararg2: object
        rUrVs   r�'test_parameters_no_more_than_one_varargz8ClinicParserTest.test_parameters_no_more_than_one_varargPs5��
"�	��-�-�/�
��	
����l�+rc�J�|jd�}|j|d�y)Nz�
              module foo
              foo.bar
                x: int
                  Nested docstring here, goeth.
                *
                y: str
              Not at column 0!
        z�
            bar($module, /, x, *, y)
            --

            Not at column 0!

              x
                Nested docstring here, goeth.
        r]r^s  r�test_function_not_at_column_0z.ClinicParserTest.test_function_not_at_column_0]r`rc�N�|jd�}d}|j||�y)Nzr
            module foo
            foo.bar
               *vararg1: object
            	*vararg2: object
        z-Tab characters are illegal in the Clinic DSL.r�r�s   r�test_indent_stack_no_tabsz*ClinicParserTest.test_indent_stack_no_tabsqs,���-�-�/�
��>���
�
�c�3�rc�J�|jd�}|jd|�y)Nzc
            module foo
            foo.bar
              a: object
             b: object
        zIllegal outdentr�r�s  r�!test_indent_stack_illegal_outdentz2ClinicParserTest.test_indent_stack_illegal_outdent{s(���-�-�/�
��	
�
�
�'��-rc����t�}t|��d�_�fd��jd<t	j
d�}�j
|�|j�j�y)NFc���t�dd�S)N�flagT)�setattr)r%s�r�<lambda>z1ClinicParserTest.test_directive.<locals>.<lambda>�s�������0Mr�setflag)rNrr��
directivesrr2r�r�)r$r�rQr%s   @r�test_directivezClinicParserTest.test_directive�sT����L���1������'M����)�$����Y�'�����U��������$rc��|jd�}|j\}}|jdj}|j	|t
j�y)Nz module os
os.access
   path: "s"r9)r�r3r;r=r<rrQ)r$rQrrr4rRs     r�test_legacy_convertersz'ClinicParserTest.test_legacy_converters�sM���
�
�?�@�� �+�+�����#�#�F�+�6�6�����d�F�$8�$8�9rc��d}d}|D]@}|j|��5|j|�}|j||�ddd��By#1swY�MxYw)N�RError on line 0:
Annotations must be either a name, a function call, or a string.
)zmodule os
os.access
   path: 42z"module os
os.access
   path: 42.42z module os
os.access
   path: 42jz"module os
os.access
   path: b"42"r��r�r+r��r$�expected_failure_messager~rQr�s     r�5test_legacy_converters_non_string_constant_annotationzFClinicParserTest.test_legacy_converters_non_string_constant_annotation�s^��
Q�	!�
���E����E��*��5�5�e�<��� � ��&>�?�+�*��*�*�r�c��d}d}|D]@}|j|��5|j|�}|j||�ddd��By#1swY�MxYw)Nr�)z3module os
os.access
   path: {"some": "dictionary"}z6module os
os.access
   path: ["list", "of", "strings"]z3module os
os.access
   path: (x for x in range(42))r�r�r�s     r�-test_other_bizarre_things_in_annotations_failz>ClinicParserTest.test_other_bizarre_things_in_annotations_fail�s^��
Q�	!�
��
�E����E��*��5�5�e�<��� � ��&>�?�+�*��*�*�r�c��d}d}|D]@}|j|��5|j|�}|j||�ddd��By#1swY�MxYw)NzHError on line 0:
Cannot use a kwarg splat in a function-call annotation
)z1module fo
fo.barbaz
   o: bool(**{None: "bang!"})z.module fo
fo.barbaz -> bool(**{None: "bang!"})z+module fo
fo.barbaz -> bool(**{"bang": 42})z0module fo
fo.barbaz
   o: bool(**{"bang": None}))r�r�)r$�expected_error_msgr~r�r�s     r�9test_kwarg_splats_disallowed_in_function_call_annotationszJClinicParserTest.test_kwarg_splats_disallowed_in_function_call_annotations�s^��
G�	�
���B������$��5�5�b�9��� � ��&8�9�%�$��$�$�r�c�R�d}d}|j|�}|j||�y)NzhError on line 0:
A 'self' parameter, if specified, must be the very first thing in the parameter block.
zz
            module foo
            foo.func
                a: int
                self: self(type="PyObject *")
        rU�r$r�rQr�s    r�test_self_param_placementz*ClinicParserTest.test_self_param_placement�s6��
(�	�
���-�-�e�4������0�1rc�R�d}d}|j|�}|j||�y)Nz?Error on line 0:
A 'self' parameter cannot be marked optional.
zj
            module foo
            foo.func
                self: self(type="PyObject *") = None
        rUr�s    r�"test_self_param_cannot_be_optionalz3ClinicParserTest.test_self_param_cannot_be_optional�s6��
>�	���
�-�-�e�4������0�1rc�R�d}d}|j|�}|j||�y)Nz�Error on line 0:
A 'defining_class' parameter, if specified, must either be the first thing in the parameter block, or come just after 'self'.
z�
            module foo
            foo.func
                self: self(type="PyObject *")
                a: int
                cls: defining_class
        rUr�s    r�#test_defining_class_param_placementz4ClinicParserTest.test_defining_class_param_placement�s7��
O�	�
���-�-�e�4������0�1rc�R�d}d}|j|�}|j||�y)NzIError on line 0:
A 'defining_class' parameter cannot be marked optional.
zs
            module foo
            foo.func
                cls: defining_class(type="PyObject *") = None
        rUr�s    r�,test_defining_class_param_cannot_be_optionalz=ClinicParserTest.test_defining_class_param_cannot_be_optional�s7��
H�	���
�-�-�e�4������0�1rc��d}d}|jt|�5|j|�ddd�y#1swYyxYw)Nz�
            module foo
            class Foo "" ""
            Foo.__init__
                cls: defining_class
                a: object
        z0Slot methods cannot access their defining class.)�assertRaisesRegexr�r*)r$rQr�s   r�.test_slot_methods_cannot_access_defining_classz?ClinicParserTest.test_slot_methods_cannot_access_defining_class�s;����A��
�
#�
#�J��
4�����&�5�
4�
4�s�6�?c�N�d}|jd�}|j||�y)Nz1Error on line 0:
__new__ must be a class method!
zT
            module foo
            class Foo "" ""
            Foo.__new__
        rU�r$r�r�s   r�test_new_must_be_a_class_methodz0ClinicParserTest.test_new_must_be_a_class_methods6��
0�	��-�-�/�
��
	
����0�1rc�N�d}|jd�}|j||�y)NzQError on line 0:
__init__ must be a normal method, not a class or static method!
zn
            module foo
            class Foo "" ""
            @classmethod
            Foo.__init__
        rUr�s   r�!test_init_must_be_a_normal_methodz2ClinicParserTest.test_init_must_be_a_normal_methods7��
P�	��-�-�/�
��	
����0�1rc���|jd�}|jd}|j��fd�}ddd�ddd�dd	d�d
d	d�f}|D]�}|j�\}}|j	||��5||�}|j||j�|jd��}	|r|jd|	�n|jd|	�|jd	��}
|jd|
�ddd���y#1swY��xYw)
Nz�
            module foo
            foo.func
                fn: object
                k: float
                i: float(unused=True)
                /
                *
                flag: bool(unused=True) = False
        rYc�"���|jSr�r=)r��paramss �rr�z4ClinicParserTest.test_unused_param.<locals>.<lambda>-s���&��*�.�.rr�F)r4�unused�k�iTr�)�	in_parser�	Py_UNUSED)
r�r3r;�valuesr�r�r��simple_declarationr��assertNotIn)r$rQ�sigrRr~�paramr4r�r@�decl�parser_declr�s           @r�test_unused_paramz"ClinicParserTest.test_unused_param s����
�
�	�	
�����q�!������.���U�+��E�*��D�)��t�,�	
���E� �<�<�>�L�D�&����4���7���J��� � �����2��+�+�e�+�<����M�M�+�t�4��$�$�[�$�7� �2�2�T�2�B��� � ��k�:�8�7��7�7�s
�0BC=�=D	c��|jddd��}|jd}|j|jtj
j�y)Nz}
            module m
            class m.C "PyObject *" ""
            m.C.meth
                cls: defining_class
        rOr�r��cls)r*r;r�rrrorpr|r?s   r�test_kind_defining_classz)ClinicParserTest.test_kind_defining_classFsU���&�&�(�
"#�1�'�6��
����&���������!2�!2�!B�!B�Crc�N�d}|jd�}|j||�y)NzQError on line 0:
A 'defining_class' parameter cannot be defined at module level.
zU
            module m
            m.func
                cls: defining_class
        rUr�s   r�,test_disallow_defining_class_at_module_levelz=ClinicParserTest.test_disallow_defining_class_at_module_levelPs7��
P�	��-�-�/�
��
	
����0�1rc�|�t�}t|�}tj|�}|j	|�|Sr)rNrrr2r�)r$�textr�r%rQs     rr�zClinicParserTest.parse\s1���L���1������T�"�����U���rc��|j|�}|j}|jt|�|�t	|dt
j�sJ�t	||t
j�sJ�||S)Nr)r�r3r�r:�
isinstancer�Module�Function)r$rr�r�rQr�s      rr*zClinicParserTest.parse_functioncsl���
�
�4� ����������Q��!4�5��!�A�$��
�
�.�.�.��!�N�+�V�_�_�=�=�=��� � rc���|jttj�d�|jttj�d�d}tj�5}|jt�5tjddd��ddd�ddd�j�}|j||�y#1swY�4xYw#1swY�8xYw)Nz
<Unspecified>z<Null>z>Error in file "clown.txt" on line 69:
The igloos are melting!
zThe igloos are melting!z	clown.txt�E)rL�line_number)r�rlr�unspecified�NULLrr r!r"�failr#)r$r�r'�actuals    r�test_scaffoldingz!ClinicParserTest.test_scaffoldingks�������f�0�0�1�?�C�����f�k�k�*�H�5�
(�	��
$�
$�
&�&��"�"�:�.����5�%0�b�B�/�'����"�������*�	/�.��'�
&�s$�)C�?C�C�C	�C�C N)r�rY)>r,r-r.r.r5r7rArErGrMrSrWr[r_rcrerirmrtrwrr�r+r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r*rr0rrr*r*s3��3�
	,�,�
A�*�
*�,�,	:�,�:�
�(
�0
�<�V�	%�
%�(
�TL
�\!�,�& �$ �$ �$ �" �"
 �	6�
6� � �D�(� �
 � �  �,�
�( �.�%�:�@� 
@�:� 
2�2�2� 2�
'�
2�2�$;�LD�
2��!�+rr*c���eZdZdZej
j
ejdd�Z	d�Z
dd�d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ClinicExternalTestNrz	clinic.pyc��t|�yr)rrEs rr~zClinicExternalTest.setUp�s
����%rT)�expect_successc��tjtjd|jg|�ddtj
tj
��5}|j
�|rD|jr8|jdjg|j�|j���|jj�}|jj�}|j|d�|cddd�S#1swYyxYw)Nz-Xutf8�utf-8r)�encoding�bufsizer'�stderrrP)�
subprocess�Popenrj�
executable�	clinic_py�PIPE�wait�
returncoder�joinr'r�readr�)r$rr5�procr'rs      r�_do_testzClinicExternalTest._do_test�s���
�
�
�
�^�^�X�t�~�~�=��=����?�?��?�?�
���I�I�K��$�/�/��	�	�"�'�'�">�D�K�K�">�$�+�+�">�?�@��[�[�%�%�'�F��[�[�%�%�'�F����V�R�(��
�
�
�s
�BC<�<Dc� �|j|�Sr�r$�r$r5s  rrz!ClinicExternalTest.expect_success�s���t�}�}�d�#�#rc�&�|j|ddi�S)NrFr&r's  rr�z!ClinicExternalTest.expect_failure�s���t�}�}�d�9�5�9�9rc��d}tj|�}t|d��5}|j�}ddd�|j	t
t�|jddt|�}|j|d�ttd��5}|j�}ddd�|j�y#1swY��xYw#1swY�(xYw)Nz
clinic.test.cr�r�-f�-orP)	r�findfile�openr"rrrrr�)r$�CLINIC_TEST�sourcer�
orig_contentsr��new_contentss       r�
test_externalz ClinicExternalTest.test_external�s���%���!�!�+�.��
�&�7�
+�q��F�F�H�M�,�	
�����'��!�!�$��f�f�=������b�!�
�&�7�
+�q��6�6�8�L�,�	
����}�5�,�
+��,�
+�s�B?�C�?C�Cc���td�}tj�5}tjj|d�}t
|dd��5}|j|�ddd�tj|�j}|j|�tj|�j}ddd�|j�y#1swY�sxYw#1swY�(xYw)Nz�
            /*[clinic input]
            [clinic start generated code]*/
            /*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/
        r|�wrr*)r	r�temp_dirr1r9r!r.�write�stat�st_mtime_nsrr�)r$�code�tmp_dirr�r�	pre_mtime�
post_mtimes       r�test_no_changez!ClinicExternalTest.test_no_change�s�����
��
�
�
�
!�W������g�x�0�B��b�#��0�A�����
�1������/�/�I�����#������0�0�J�
"�	
����J�/�1�0��"�
!�s$�/C�C�!AC�C	�C�C(c�|�td�}td�}tj�5}tjj|d�}t
|dd��5}|j|�ddd�|j|�}|j|j|��|jd|�}|j|d�d	}t
|d��5}|j�}ddd�|jj|��ddd�y#1swY��xYw#1swY�>xYw#1swYyxYw)
NaA
            /*[clinic input]
            output preset block
            module test
            test.fn
                a: int
            [clinic start generated code]*/

            const char *hand_edited = "output block is overwritten";
            /*[clinic end generated code: output=bogus input=bogus]*/
        z�
            Checksum mismatch!
            Expected: bogus
            Computed: 2ed19
            Suggested fix: remove all generated code including the end marker,
            or use the '-f' option.
        r|r5rr*r+rPzP/*[clinic end generated code: output=99dd9b13ffdc660d input=9543a8d2da235301]*/
)r	rr6r1r9r!r.r7r�r��endswithrr�r")	r$�
invalid_input�fail_msgr;r�rr��checksum�	generateds	         r�test_cli_forcez!ClinicExternalTest.test_cli_force�s���
 �

�
���
���
�
�
!�W������g�x�0�B��b�#��0�A����
�&�1�
�%�%�b�)�C��O�O�C�L�L��2�3��%�%�d�B�/�C����S�"�%�F�
��b�7�+�q��F�F�H�	�,��O�O�I�.�.�x�8�9�'"�
!�0�0��,�+��#"�
!�s<�/D2�D�,A,D2�D&�)(D2�D#	�D2�&D/	�+D2�2D;c��td�}d}d}d}d�}tj�5}||||�||||�tjj|d�}tj|��5}||||�|j
dd	d
|�}	ddd�|D]O}
|j|
��5tjj||
�}|j|	�ddd��Q|D]O}
|j|
��5tjj||
�}|j|	�ddd��Q|D]O}
|j|
��5tjj||
�}|j|	�ddd��Q	ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)NzR
            /*[clinic input]
            [clinic start generated code]*/
        �pass)zfile1.czfile2.c)zfile1.pyzfile2.pyc��|D]J}tjj||�}t|dd��5}|j	|�ddd��Ly#1swY�WxYw)Nr5rr*)r1r9r!r.r7)�files�srcdirr:r�r9rs      r�create_filesz6ClinicExternalTest.test_cli_make.<locals>.create_files�sH�����w�w�|�|�F�B�/���$��g�6�!��G�G�D�M�7�6��6�6�s�A�A	�	externals)r9�-v�--make�--srcdirr})
r	rr6r1r9r!rr�r�r�)r$�c_code�py_code�c_files�py_filesrKr;�ext_pathrLr�rLr9s            r�
test_cli_makez ClinicExternalTest.test_cli_make�s�����
����&��)��	"��
�
�
!�W���'�6�2���7�G�4��w�w�|�|�G�[�9�H��#�#��2�i��W�i��8��)�)�$��*�g�N��	3�$���\�\�8�\�4��7�7�<�<���:�D��M�M�$��,�5�4�$�%���\�\�8�\�4��7�7�<�<���:�D��$�$�T�3�/�5�4�%�
$���\�\�8�\�4��7�7�<�<��(�;�D��$�$�T�3�/�5�4�$�/"�
!�3�2��5�4��5�4��
5�4��1"�
!�sl�AG�4F!�G�23F.�%!G�3F;�9!G�3G�
G�!F+	�&G�.F8�3G�;G�G�G�G�Gc�b�tj�5}tjj	|d�}t|dd��5}|j
d�ddd�|jd|�}|j|j�|�ddd�y#1swY�DxYw#1swYyxYw)Nr|r5rr*rPrM)
rr6r1r9r!r.r7rr�r�)r$r;r�rr�s     r�test_cli_verbosez#ClinicExternalTest.test_cli_verboses���
�
�
�
!�W������g�x�0�B��b�#��0�A������1��%�%�d�B�/�C����S�Y�Y�[�"�-�"�
!�0�0��"�
!�s#�/B%�B�:B%�B"	�B%�%B.c�J�|jd�}|jd|�y)Nz-h�usage: clinic.py)rr�r�s  r�
test_cli_helpz ClinicExternalTest.test_cli_helps!���!�!�$�'���
�
�(�#�.rc	�$�td�}d}td�}|jd�}|j|j|�|�|j|j	|�|�|j|�}|j
|�}|jd�}t||�D]W\}}|j�}|j|��5|j|j|�d|�d|���ddd��Yy#1swY�dxYw)	Nz�
            Legacy converters:
                B C D L O S U Y Z Z#
                b c d f h i l p s s# s* u u# w* y y# y* z z# z*

            Converters:
        )�bool�byte�char�defining_class�double�fildes�float�int�long�	long_long�object�	Py_buffer�
Py_complex�
Py_ssize_t�
Py_UNICODE�PyByteArrayObject�
PyBytesObjectr$�short�size_t�slice_index�str�unicode�
unsigned_char�unsigned_int�
unsigned_long�unsigned_long_long�unsigned_shorta�
            Return converters:
                bool()
                double()
                float()
                init()
                int()
                long()
                Py_ssize_t()
                size_t()
                unsigned_int()
                unsigned_long()

            All converters also accept (c_default=None, py_default=None, annotation=None).
            All return converters also accept (py_default=None).
        �--convertersr�r�zexpected converter z, got )r	rr�r�r@�removeprefix�removesuffixr��zipr�r�)r$�prelude�expected_converters�finaler��linesr=�lines        r�test_cli_convertersz&ClinicExternalTest.test_cli_converterss�����
��
��<��
�� �!�!�.�1��
	
������w�/��5�������V�,�c�2����w�'�����v�&���	�	�$���"�#6��>�O�I�t��;�;�=�D����	��2�����O�O�I�.�)�)��f�T�H�E��3�2� ?�2�2�s�(D�D	c�P�|jdd�}d}|j||�y)Nrwr|zGUsage error: can't specify --converters and a filename at the same timer�r�s   r�%test_cli_fail_converters_and_filenamez8ClinicExternalTest.test_cli_fail_converters_and_filenamegs.���!�!�.�(�;��
.�	�	
�
�
�c�3�rc�H�|j�}|jd|�y)NrYr�r�s  r�test_cli_fail_no_filenamez,ClinicExternalTest.test_cli_fail_no_filenameos���!�!�#���
�
�(�#�.rc�T�|jdddd�}d}|j||�y)Nr,�out.czinput.czmoreinput.cz1Usage error: can't use -o with multiple filenamesr�r�s   r�'test_cli_fail_output_and_multiple_filesz:ClinicExternalTest.test_cli_fail_output_and_multiple_filesss+���!�!�$���M�J��A���
�
�c�3�rc��dD]D}|j|��5|jdg|���}d}|j||�ddd��Fy#1swY�QxYw)N))r,r�)z
filename.c)�optsrNz2Usage error: can't use -o or filenames with --make)r�r�r�)r$r�r�r�s    r�)test_cli_fail_filename_or_output_and_makez<ClinicExternalTest.test_cli_fail_filename_or_output_and_makexsS��4�D����4��(�)�d�)�)�(�:�T�:��J���
�
�c�3�'�)�(�5�(�(���(A�A	c�R�|jddd�}d}|j||�y)NrNrOrPz3Usage error: --srcdir must not be empty with --maker�r�s   r�!test_cli_fail_make_without_srcdirz4ClinicExternalTest.test_cli_fail_make_without_srcdirs)���!�!�(�J��;��C���
�
�c�3�r)r,r-r.r/r1r9r!r�toolsdirrr~r$rr�r3r>rErUrWrZr�r�r�r�r�r�r0rrrr}s|���G������Z�0�0�(�K�H�I�&�.2��"$�:�6� 0�(&:�P)0�V.�/�G�R �/� �
(� rrz_testclinic is missingc��eZdZe�j	d�ee�D��d�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�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d&�Z+d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d-�Z2d.�Z3d/�Z4d0�Z5d1�Z6d2�Z7d3�Z8d4�Z9d5�Z:d6�Z;d7�Z<y8)9�ClinicFunctionalTestc#�bK�|]'}|jd�r|tt|�f���)y�w)�test_N)r��getattr�	ac_tester)�.0r4s  r�	<genexpr>zClinicFunctionalTest.<genexpr>�s0����L� .��$�/�/�'�2J��7�9�d�3�4� .�s�-/c�f�|jt�5tj�ddd�|j	tjdd�d�|j	tjgd�gdf�|j	tjd�d�y#1swY�}xYw)NrYr��rYr�zwhatever class)rYN)r!�	TypeErrorr��objects_converterr�rEs r�test_objects_converterz+ClinicFunctionalTest.test_objects_converter�s���
�
�
�y�
)��'�'�)�*�����4�4�Q��:�F�C�����4�4�R�9I�J�R�Qa�Lb�c�����4�4�Q�7��C�	*�
)�s�B'�'B0c���|jt�5tjd�ddd�|j	tjd�d�y#1swY�/xYw)NrY�BytesObject)r�)r!r�r��bytes_object_converterr�rEs r�test_bytes_object_converterz0ClinicFunctionalTest.test_bytes_object_converter�sH��
�
�
�y�
)��,�,�Q�/�*�����9�9�.�I�K\�]�*�
)���A�A#c���|jt�5tjd�ddd�t	d�}|jtj|�|f�y#1swY�;xYw)NrYsByteArrayObject)r!r�r��byte_array_object_converter�	bytearrayr�)r$�byte_arrs  r� test_byte_array_object_converterz5ClinicFunctionalTest.test_byte_array_object_converter�sT��
�
�
�y�
)��1�1�!�4�*��/�0������>�>�x�H�8�+�V�*�
)�s�A&�&A/c���|jt�5tjd�ddd�|j	tjd�d�y#1swY�/xYw)NrYrq)rq)r!r�r��unicode_converterr�rEs r�test_unicode_converterz+ClinicFunctionalTest.test_unicode_converter�sG��
�
�
�y�
)��'�'��*�*�����4�4�Y�?��N�*�
)�r�c�n�|jt�5tjddd�ddd�|j	tj�d�|j	tjdgd�d�|j	tjddd	id
�d�y#1swY�~xYw)NFz	not a int)TTTrP�)FFT)z	not emptyrYr�r)TTF)r!r�r��bool_converterr�rEs r�test_bool_converterz(ClinicFunctionalTest.test_bool_converter�s���
�
�
�y�
)��$�$�U�E�;�?�*�����1�1�3�5G�H�����1�1�"�b�!�<�>R�S�����1�1�.�1�a�&�!�L�Na�b�	*�
)�s�B+�+B4c���|jt�5tjd�ddd�|jt�5tjd�ddd�gd�}t	d�|D��}|jtj�|�gd�}t	d�|D��}|jtj|�|�y#1swY��xYw#1swY��xYw)NrYsab)�A���	�
���
�"�'�?�\���c3�2K�|]}t|����y�wr��ord�r�r�s  rr�z;ClinicFunctionalTest.test_char_converter.<locals>.<genexpr>������/��A��Q�����)�1�2�3�4�5�6�7�8�9�0�a�b�c�dc3�2K�|]}t|����y�wrr�r�s  rr�z;ClinicFunctionalTest.test_char_converter.<locals>.<genexpr>�r�r�)r!r�r��char_converter�tupler�)r$�charsr�s   r�test_char_converterz(ClinicFunctionalTest.test_char_converter�s���
�
�
�y�
)��$�$�Q�'�*�
�
�
�y�
)��$�$�U�+�*�r���/��/�/������1�1�3�X�>�d���/��/�/������1�1�5�9�8�D�*�
)��
)�
)�s�C�	C&�C#�&C/c��ddlm}|jt�5t	j
d�ddd�|jt�5t	j
|dz�ddd�|jt�5t	j
d|dz�ddd�|jt�5t	j
g�ddd�|jt	j
�d�|jt	j
dd|dz�d�|jt	j
dd|dzdzdz�d	�y#1swY��)xYw#1swY��xYw#1swY��xYw#1swY��xYw)
Nr)�	UCHAR_MAXr�rY���"�8�rrrrO�{�rrr�)�	_testcapir�r!�
OverflowErrorr��unsigned_char_converterr�r�)r$r�s  r�test_unsigned_char_converterz1ClinicFunctionalTest.test_unsigned_char_converter�s��'�
�
�
�}�
-��-�-�b�1�.�
�
�
�}�
-��-�-�i�!�m�<�.�
�
�
�}�
-��-�-�a��Q��?�.�
�
�
�y�
)��-�-�b�1�*�����:�:�<�l�K�����:�:�1�a��Q��O�QZ�[�����:�:�1�a�)�a�-�ST�AT�WZ�AZ�[�]h�i�.�
-��
-�
-��
-�
-��
)�
)��/�E�E&�E2�<E>�E#�&E/�2E;�>Fc�.�ddlm}m}|jt�5tj|dz
�ddd�|jt�5tj|dz�ddd�|jt�5tjg�ddd�|jtjd�d�|jtjd�d�y#1swY��xYw#1swY��xYw#1swY�lxYw)Nr)�SHRT_MIN�SHRT_MAXrY�.����r���)r�)	r�r�r�r!r�r��short_converterr�r�)r$r�r�s   r�test_short_converterz)ClinicFunctionalTest.test_short_converter�s���0�
�
�
�}�
-��%�%�h��l�3�.�
�
�
�}�
-��%�%�h��l�3�.�
�
�
�y�
)��%�%�b�)�*�����2�2�5�9�8�D�����2�2�4�8�'�B�.�
-��
-�
-��
)�
)�s#�C3�C?�
D�3C<�?D�Dc��ddlm}|jt�5t	j
d�ddd�|jt�5t	j
|dz�ddd�|jt�5t	j
d|dz�ddd�|jt�5t	j
g�ddd�|jt	j
�d�|jt	j
dd|dz�d�|jt	j
dd|dzdzdz�d	�y#1swY��)xYw#1swY��xYw#1swY��xYw#1swY��xYw)
Nr)�	USHRT_MAXr�rYr�r�rOr�r�)	r�r�r!r�r��unsigned_short_converterr�r�r�)r$r�s  r�test_unsigned_short_converterz2ClinicFunctionalTest.test_unsigned_short_converter�s��'�
�
�
�z�
*��.�.�r�2�+�
�
�
�}�
-��.�.�y�1�}�=�.�
�
�
�}�
-��.�.�q�)�a�-�@�.�
�
�
�y�
)��.�.�r�2�*�����;�;�=�|�L�����;�;�A�q�)�a�-�P�R[�\�����;�;�A�q�9�q�=�TU�BU�X[�B[�\�^i�j�+�
*��
-�
-��
-�
-��
)�
)�r�c���ddlm}m}|jt�5tj|dz
�ddd�|jt�5tj|dz�ddd�|jt�5tjddd�ddd�|jt�5tjg�ddd�|jtj�d�|jtjddd�ddtd�f�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw)Nr)�INT_MIN�INT_MAXrYr�rO)r�r��-�3)
r�r�r�r!r�r�r>r�r�r�)r$r�r�s   r�test_int_converterz'ClinicFunctionalTest.test_int_converter�s���.�
�
�
�}�
-��#�#�G�a�K�0�.�
�
�
�}�
-��#�#�G�a�K�0�.�
�
�
�y�
)��#�#�A�q�!�,�*�
�
�
�y�
)��#�#�B�'�*�����0�0�2�L�A�����0�0��A�s�;�a��C��H�=M�N�.�
-��
-�
-��
)�
)��
)�
)�s/�D5�E�
E
�?E�5D>�E
�
E�E"c��ddlm}|jt�5t	j
d�ddd�|jt�5t	j
|dz�ddd�|jt�5t	j
d|dz�ddd�|jt�5t	j
g�ddd�|jt	j
�d�|jt	j
dd|dz�d�|jt	j
dd|dzdzdz�d	�y#1swY��)xYw#1swY��xYw#1swY��xYw#1swY��xYw)
Nr)�UINT_MAXr�rYr�r�rOr�r�)	r�r�r!r�r��unsigned_int_converterr�r�r�)r$r�s  r�test_unsigned_int_converterz0ClinicFunctionalTest.test_unsigned_int_converter�s��&�
�
�
�z�
*��,�,�R�0�+�
�
�
�}�
-��,�,�X��\�:�.�
�
�
�}�
-��,�,�Q��1��=�.�
�
�
�y�
)��,�,�R�0�*�����9�9�;�\�J�����9�9�!�Q��1��M�y�Y�����9�9�!�Q��A��QR�@R�UX�@X�Y�[f�g�+�
*��
-�
-��
-�
-��
)�
)�r�c�,�ddlm}m}|jt�5tj|dz
�ddd�|jt�5tj|dz�ddd�|jt�5tjg�ddd�|jtj�d�|jtjd�d�y#1swY��xYw#1swY��xYw#1swY�kxYw)Nr)�LONG_MIN�LONG_MAXrY�r�r�r�)	r�r�r�r!r�r��long_converterr�r�)r$r�r�s   r�test_long_converterz(ClinicFunctionalTest.test_long_converter�s���0�
�
�
�}�
-��$�$�X��\�2�.�
�
�
�}�
-��$�$�X��\�2�.�
�
�
�y�
)��$�$�R�(�*�����1�1�3�U�;�����1�1�%�8�(�C�.�
-��
-�
-��
)�
)��#�C2�C>�
D
�2C;�>D�
Dc��ddlm}|jt�5t	j
d�ddd�|jt�5t	j
|dz�ddd�|jt�5t	j
d|dz�ddd�|jt�5t	j
g�ddd�|jt	j
�d�|jt	j
dd|dz�d�|jt	j
dd|dzdzdz�d	�y#1swY��)xYw#1swY��xYw#1swY��xYw#1swY��xYw)
Nr)�	ULONG_MAXr�rYr�r�rOr�r�)	r�rr!r�r��unsigned_long_converterr�r�r�)r$rs  r�test_unsigned_long_converterz1ClinicFunctionalTest.test_unsigned_long_converters��'�
�
�
�z�
*��-�-�b�1�+�
�
�
�}�
-��-�-�i�!�m�<�.�
�
�
�}�
-��-�-�a��Q��?�.�
�
�
�y�
)��-�-�b�1�*�����:�:�<�l�K�����:�:�1�a��Q��O�QZ�[�����:�:�1�a�)�a�-�ST�AT�WZ�AZ�[�]h�i�+�
*��
-�
-��
-�
-��
)�
)�r�c�,�ddlm}m}|jt�5tj|dz
�ddd�|jt�5tj|dz�ddd�|jt�5tjg�ddd�|jtj�d�|jtjd�d�y#1swY��xYw#1swY��xYw#1swY�kxYw)Nr)�	LLONG_MIN�	LLONG_MAXrYr�r�r�)	r�rrr!r�r��long_long_converterr�r�)r$rrs   r�test_long_long_converterz-ClinicFunctionalTest.test_long_long_converters���2�
�
�
�}�
-��)�)�)�a�-�8�.�
�
�
�}�
-��)�)�)�a�-�8�.�
�
�
�y�
)��)�)�"�-�*�����6�6�8�%�@�����6�6�u�=�x�H�.�
-��
-�
-��
)�
)�r�c��ddlm}|jt�5t	j
d�ddd�|jt�5t	j
|dz�ddd�|jt�5t	j
d|dz�ddd�|jt�5t	j
g�ddd�|jt	j
�d�|jt	j
dd|dz�d�|jt	j
dd|dzdzdz�d	�y#1swY��)xYw#1swY��xYw#1swY��xYw#1swY��xYw)
Nr)�
ULLONG_MAXr�rYr�r�rOr�r�)	r�r
r!r�r��unsigned_long_long_converterr�r�r�)r$r
s  r�!test_unsigned_long_long_converterz6ClinicFunctionalTest.test_unsigned_long_long_converters ��(�
�
�
�z�
*��2�2�2�6�+�
�
�
�}�
-��2�2�:��>�B�.�
�
�
�}�
-��2�2�1�j�1�n�E�.�
�
�
�y�
)��2�2�2�6�*�����?�?�A�<�P�����?�?��1�j�ST�n�U�W`�a�����?�?��1�z�TU�~�YZ�FZ�]`�F`�a�cn�o�+�
*��
-�
-��
-�
-��
)�
)�r�c�0�ddlm}m}|jt�5tj|dz
�ddd�|jt�5tj|dz�ddd�|jt�5tjg�ddd�|jtj�d�|jtjddd�d�y#1swY��xYw#1swY��xYw#1swY�mxYw)Nr��PY_SSIZE_T_MIN�PY_SSIZE_T_MAXrYr�r��rYr�r�)	r�rrr!r�r��py_ssize_t_converterr�r��r$rrs   r�test_py_ssize_t_converterz.ClinicFunctionalTest.test_py_ssize_t_converter-s���<�
�
�
�}�
-��*�*�>�A�+=�>�.�
�
�
�}�
-��*�*�>�A�+=�>�.�
�
�
�y�
)��*�*�2�.�*�����7�7�9�<�H�����7�7��1�d�C�Z�P�.�
-��
-�
-��
)�
)�s#�C4�D�
D�4C=�D	�Dc���ddlm}m}|jt�5tjg�ddd�|jtj�d�|jtjddd�d�|jtj||dz|dz�|||f�|jtj||dz
|dz
�|||f�y#1swY��xYw)Nrrr�rYr�ri�)r�rrr!r�r��slice_index_converterr�rs   r�test_slice_index_converterz/ClinicFunctionalTest.test_slice_index_converter8s���<�
�
�
�y�
)��+�+�B�/�*�����8�8�:�L�I�����8�8��A�t�D�j�Q�����8�8���Z[�I[�]k�nr�]r�s�(�.�.�I�	K�����8�8���Z[�I[�]k�nr�]r�s�(�.�.�I�	K�
*�
)�s�C(�(C1c�H�|jt�5tjd�ddd�|jt�5tjg�ddd�|jtj�d�y#1swY�axYw#1swY�:xYw)Nr�r�)r!r�r��size_t_converterr�r�rEs r�test_size_t_converterz*ClinicFunctionalTest.test_size_t_converterCsm��
�
�
�z�
*��&�&�r�*�+�
�
�
�y�
)��&�&�r�*�*�����3�3�5�u�=�	+�
*��
)�
)�s�B�	B�B�B!c��|jt�5tjg�ddd�|j	tj�d�|j	tjd�d�y#1swY�SxYw�N)g)@�࿩r)r!r�r��float_converterr�rEs r�test_float_converterz)ClinicFunctionalTest.test_float_converterJs`��
�
�
�y�
)��%�%�b�)�*�����2�2�4�g�>�����2�2�4�8�'�B�*�
)���A>�>Bc��|jt�5tjg�ddd�|j	tj�d�|j	tjd�d�y#1swY�SxYwr)r!r�r��double_converterr�rEs r�test_double_converterz*ClinicFunctionalTest.test_double_converterPs`��
�
�
�y�
)��&�&�r�*�*�����3�3�5�w�?�����3�3�D�9�7�C�*�
)�r!c��|jt�5tjg�ddd�|j	tjtdd��tdd�f�|j	tjtd��td�f�|j	tjd�d�|j	tjd�d�y#1swY��xYw)NrYr�z-1-2jrr�
)r&)r!r�r��py_complex_converterr��complexrEs r�test_py_complex_converterz.ClinicFunctionalTest.test_py_complex_converterVs���
�
�
�y�
)��*�*�2�.�*�����7�7���1�
�F��QR�TU��HX�Y�����7�7���8H�I�G�T[�L\�K^�_�����7�7��=�w�G�����7�7��;�U�C�*�
)�s�C1�1C:c�p�|jt�5tjd�ddd�|jt�5tjddd�ddd�|jt�5tjddd�ddd�|jtjddd�d�|jtjddd�d�|jtjddd	�d
�y#1swY��xYw#1swY��xYw#1swY��xYw)NrYr�r�r��bbr�r�r��cc�r�r�r,)r!r�r�rQr�r�rEs r�test_str_converterz'ClinicFunctionalTest.test_str_converter^s���
�
�
�y�
)��#�#�A�&�*�
�
�
�y�
)��#�#�C��c�2�*�
�
�
�z�
*��#�#�C��#�6�+�����0�0��d�C�@�/�R�����0�0��d�D�A�?�S�����0�0��d�F�C�EW�X�*�
)��
)�
)��
*�
*�s#�D�	D �>D,�D� D)�,D5c
��|jt�5tjd�ddd�|j	tjddd�d�|jt�5tjddd�ddd�|j	tjddtt
d�g��d�|j	tjddtt
d�dt
d�g��d	�|j	tjddd
�d	�y#1swY��
xYw#1swY��xYw)NrYr�r�r�r�r+r�rr-scc)r!r�r��str_converter_encodingr�r�r�rEs r�test_str_converter_encodingz0ClinicFunctionalTest.test_str_converter_encodingis��
�
�
�y�
)��,�,�Q�/�*�����9�9�#�s�C�H�/�Z�
�
�
�y�
)��,�,�S�'�3�?�*�����9�9�#�t�Y�PS�TW�PX�z�EZ�[�]l�m�����9�9�#�t�Y�PS�TW�PX�Z[�]`�ad�]e�Of�Eg�h�-�	/�����9�9�#�t�Y�O�Qe�f�*�
)��*�
)�s�D7�0E�7E�E
c	���|jt�5tjdd�ddd�|j	tjdtgd���d�y#1swY�;xYw)Nr�r��abc�rYr�rO)sabcs)r!r�r��py_buffer_converterr�r�rEs r�test_py_buffer_converterz-ClinicFunctionalTest.test_py_buffer_convertertsQ��
�
�
�y�
)��)�)�#�s�3�*�����6�6�u�i�	�>R�S�Un�o�*�
)�s�A'�'A0c���|jtjdd�d�|jtjdd��d�|jtjdd��d�y)NrYr�r��r�r�)r�r��keywordsrEs r�
test_keywordsz"ClinicFunctionalTest.test_keywordsysY������+�+�A�q�1�6�:�����+�+�A��3�V�<�����+�+�a�1�5�v�>rc� �|jt�5tjdd�ddd�|j	tjdd��d�|j	tjdd��d�y#1swY�XxYw)NrYr�r8r�r�)r!r�r��keywords_kwonlyr�rEs r�test_keywords_kwonlyz)ClinicFunctionalTest.test_keywords_kwonly~sh��
�
�
�y�
)��%�%�a��+�*�����2�2�1��:�F�C�����2�2�Q�!�<�f�E�*�
)�s�B�B
c�$�|jtjd�d�|jtjdd�d�|jtjddd�d�|jtjdd��d�|jtjddd��d�|jtjdd�	�d
�|jtjddd��d�y)NrY�rYNNr��rYr�NrOr4r8�r��r�r��rYNrOr�)r�r��keywords_optrEs r�test_keywords_optz&ClinicFunctionalTest.test_keywords_opt�s�������/�/��2�O�D�����/�/��1�5�|�D�����/�/��1�a�8�)�D�����/�/��Q�7��F�����/�/��1��:�I�F�����/�/�!�q�9�<�H�����/�/�!�q�A�>�	�Jrc�Z�|jtjd�d�|jtjdd�d�|jt�5tjddd�ddd�|jtjdd��d�|jtjddd��d�|jtjdd�	�d
�|jtjdddd��d
�y#1swY��xYw)NrY�rYNNNr��rYr�NNrOr8rA�rYr�rONrB)rYNrON��r�r�r�rh�rYr�rOrJ)r�r��keywords_opt_kwonlyr!r�rEs r�test_keywords_opt_kwonlyz-ClinicFunctionalTest.test_keywords_opt_kwonly�s�������6�6�q�9�;P�Q�����6�6�q�!�<�>P�Q�
�
�
�y�
)��)�)�!�Q��2�*�����6�6�q�A�>�@R�S�����6�6�q�!�q�A�?�S�����6�6��a�@�BT�U�����6�6��a�1��J�L�Y�*�
)�s�!D!�!D*c��|jtjd�d�|jt�5tjdd�ddd�|jtjdd��d�|jtjdd��d�|jtjddd�	�d
�y#1swY��xYw)NrYr?r�r8r@rOrBrCr�r4)r�r��keywords_kwonly_optr!r�rEs r�test_keywords_kwonly_optz-ClinicFunctionalTest.test_keywords_kwonly_opt�s�������6�6�q�9�?�K�
�
�
�y�
)��)�)�!�Q�/�*�����6�6�q�A�>��M�����6�6��a�@�,�O�����6�6��a�1�E�y�Q�	*�
)�s�C�Cc��|jt�5tjd�ddd�|jt�5tjdd��ddd�|j	tjdd�d�|j	tjdd��d�y#1swY��xYw#1swY�cxYw)NrYr�r�r�r8)r!r�r��posonly_keywordsr�rEs r�test_posonly_keywordsz*ClinicFunctionalTest.test_posonly_keywords�s���
�
�
�y�
)��&�&�q�)�*�
�
�
�y�
)��&�&��a�0�*�����3�3�A�q�9�6�B�����3�3�A��;�V�D�*�
)��
)�
)�s�B7�	C�7C�Cc���|jt�5tjd�ddd�|jt�5tjdd�ddd�|jt�5tjdd��ddd�|j	tjdd��d�y#1swY��xYw#1swY�rxYw#1swY�IxYw)NrYr�r�r8r�)r!r�r��posonly_kwonlyr�rEs r�test_posonly_kwonlyz(ClinicFunctionalTest.test_posonly_kwonly�s���
�
�
�y�
)��$�$�Q�'�*�
�
�
�y�
)��$�$�Q��*�*�
�
�
�y�
)��$�$�q�A�.�*�����1�1�!�q�9�6�B�
*�
)��
)�
)��
)�
)�s#�C�	C�=C�C�C�C&c�(�|jt�5tjd�ddd�|jt�5tjddd�ddd�|jt�5tjddd��ddd�|j	tjddd��d�|j	tjddd��d�y#1swY��xYw#1swY��xYw#1swY�rxYw)NrYr�rOr�rAr4�r�r�)r!r�r��posonly_keywords_kwonlyr�rEs r�test_posonly_keywords_kwonlyz1ClinicFunctionalTest.test_posonly_keywords_kwonly�s���
�
�
�y�
)��-�-�a�0�*�
�
�
�y�
)��-�-�a��A�6�*�
�
�
�y�
)��-�-��Q�!�<�*�����:�:�1�a�1�E�y�Q�����:�:�1��Q�G��S�*�
)��
)�
)��
)�
)�s#�C0�	C<�>D�0C9�<D�Dc���|jt�5tjd�ddd�|j	tjdd�d�|j	tjddd�d�|j	tjdddd�d�|j	tjdd��d�|j	tjddd�	�d�|jt�5tjdddd�
�ddd�|j	tjdddd��d�y#1swY��/xYw#1swY�@xYw)NrYr�rHrOrIrJrLr8rArK�r�r�rh)r!r�r��posonly_keywords_optr�rEs r�test_posonly_keywords_optz.ClinicFunctionalTest.test_posonly_keywords_opt�s��
�
�
�y�
)��*�*�1�-�*�����7�7��1�=�?Q�R�����7�7��1�a�@�/�R�����7�7��1�a��C�\�R�����7�7��Q�?�AS�T�����7�7��1��B�O�T�
�
�
�y�
)��*�*�Q�!�q�A�>�*�����7�7��Q�!�q�I�<�X�*�
)��*�
)�s�E�
E&�E#�&E/c���|jtjd�d�|jtjdd�d�|jtjddd�d�|jtjdddd�d�|jt�5tjdd�	�ddd�|jtjddd�
�d�|jtjdddd��d�|jt�5tjdddd��ddd�y#1swY��xYw#1swYyxYw)
NrYrGr�rHrOrIrJrLr8rA�r�rhrK)r�r��posonly_opt_keywords_optr!r�rEs r�test_posonly_opt_keywords_optz2ClinicFunctionalTest.test_posonly_opt_keywords_opt�s������;�;�A�>�@U�V�����;�;�A�q�A�CU�V�����;�;�A�q�!�D�o�V�����;�;�A�q�!�Q�G��V�
�
�
�y�
)��.�.�q�A�6�*�����;�;�A�q�A�F��X�����;�;�A�q�A��K�\�Z�
�
�
�y�
)��.�.��a�1��B�*�
)�	*�
)��*�
)�s�0E�6E%�E"�%E.c�x�|jt�5tjd�ddd�|jt�5tjdd�ddd�|j	tjdd��d�|j	tjddd��d�|j	tjdddd�	�d
�|jt�5tjdddd��ddd�y#1swY��xYw#1swY��xYw#1swYyxYw)NrYr�r8rHrOrYrIrJr]rLrK)r!r�r��posonly_kwonly_optr�rEs r�test_posonly_kwonly_optz,ClinicFunctionalTest.test_posonly_kwonly_opt�s���
�
�
�y�
)��(�(��+�*�
�
�
�y�
)��(�(��A�.�*�����5�5�a�1�=�?Q�R�����5�5�a�1��B�O�T�����5�5�a�1��Q�G��V�
�
�
�y�
)��(�(�1��Q�!�<�*�
)�*�
)��
)�
)��
*�
)�s#�D�	D$�5D0�D!�$D-�0D9c�@�|jtjd�d�|jtjdd�d�|jt�5tjddd�ddd�|jt�5tjdd��ddd�|jtjddd��d�|jtjdddd	�
�d�y#1swY��xYw#1swY�gxYw)NrYrGr�rHrOr8rArIrJrarL)r�r��posonly_opt_kwonly_optr!r�rEs r�test_posonly_opt_kwonly_optz0ClinicFunctionalTest.test_posonly_opt_kwonly_opt�s�������9�9�!�<�>S�T�����9�9�!�Q�?�AS�T�
�
�
�y�
)��,�,�Q��1�5�*�
�
�
�y�
)��,�,�Q�!�4�*�����9�9�!�Q�!�D�o�V�����9�9�!�Q�!�q�I�<�X�*�
)��
)�
)�s�!D�D�D�Dc	���|jt�5tjd�ddd�|jt�5tjdd�ddd�|jt�5tjdd��ddd�|jt�5tjddd�ddd�|jt�5tjddd��ddd�|j	tjddd��d�|j	tjddd��d�|j	tjdddd	�
�d�|j	tjdddd	d�
�d�y#1swY���xYw#1swY��[xYw#1swY��3xYw#1swY��xYw#1swY��xYw)NrYr�r8rOr�rA�rYr�rONNrYrJra�rYr�rOrJNr��r�rh�e�rYr�rOrJr�)r!r�r��posonly_keywords_kwonly_optr�rEs r� test_posonly_keywords_kwonly_optz5ClinicFunctionalTest.test_posonly_keywords_kwonly_opt�s_��
�
�
�y�
)��1�1�!�4�*�
�
�
�y�
)��1�1�!�Q�7�*�
�
�
�y�
)��1�1�!�q�9�*�
�
�
�y�
)��1�1�!�Q��:�*�
�
�
�y�
)��1�1�A��a�@�*�����>�>�q�!�q�I�K`�a�����>�>�q�A��K�Mb�c�����>�>�q�!�q�A�N�Pb�c�����>�>�q�!�q�A�QR�S�Ud�e�*�
)��
)�
)��
)�
)��
)�
)��
)�
)�s;�F,�	F9�=G�2G�'G �,F6�9G�G�G� G)c	��|jt�5tjd�ddd�|j	tjdd�d�|j	tjdd��d�|jt�5tjdddd�ddd�|jt�5tjdd��ddd�|j	tjddd��d	�|j	tjddd�
�d	�|j	tjdddd��d�|j	tjdddd�
�d�|j	tjddddd��d�|j	tjddddd��d�y#1swY���xYw#1swY��CxYw#1swY��xYw)NrYr�)rYr�NNNr8rOrJr�rArkrY�rhrlrar��rhrnrorm)r!r�r��posonly_keywords_opt_kwonly_optr�rEs r�$test_posonly_keywords_opt_kwonly_optz9ClinicFunctionalTest.test_posonly_keywords_opt_kwonly_opt�s���
�
�
�y�
)��5�5�a�8�*�����B�B�1�a�H�Jb�c�����B�B�1��J�Ld�e�
�
�
�y�
)��5�5�a��A�q�A�*�
�
�
�y�
)��5�5��Q�?�*�����B�B�1�a�1�M�Od�e�����B�B�1��Q�O�Qf�g�����B�B�1�a��a�P�Rd�e�����B�B�1�a�1�PQ�R�Tf�g�����B�B�1�a��a�ST�U�Wf�g�����B�B�1�a�1�PQ�UV�W�Yh�i�*�
)��*�
)��
)�
)�s#�G#�G0�G=�#G-�0G:�=Hc���|jtjd�d�|jtjdd�d�|jt�5tjdd��ddd�|jtjddd�d�|jtjddd��d�|jtjdddd	�
�d�|jtjdddd	��d�|jt�5tjdddd	�ddd�y#1swY��xYw#1swYyxYw)
NrYrGr�rHr8rOrIrArJrsrLra)r�r��#posonly_opt_keywords_opt_kwonly_optr!r�rEs r�(test_posonly_opt_keywords_opt_kwonly_optz=ClinicFunctionalTest.test_posonly_opt_keywords_opt_kwonly_opts!������F�F�q�I�K`�a�����F�F�q�!�L�N`�a�
�
�
�y�
)��9�9�!�q�A�*�����F�F�q�!�Q�O�Q`�a�����F�F�q�!�q�Q�Sb�c�����F�F�q�!�Q�RS�T�Vb�c�����F�F�q�!�q�TU�V�Xd�e�
�
�
�y�
)��9�9�!�Q��1�E�*�
)�
*�
)��*�
)�s�!E�7E%�E"�%E.c�J�|jt�5tj�ddd�|jt�5tjd�ddd�|j	tjd��d�y#1swY�cxYw#1swY�<xYw)NrYr��rY)r!r�r��keyword_only_parameterr�rEs r�test_keyword_only_parameterz0ClinicFunctionalTest.test_keyword_only_parametersm��
�
�
�y�
)��,�,�.�*�
�
�
�y�
)��,�,�Q�/�*�����9�9�A�>��E�	*�
)��
)�
)�s�B
�B�
B�B"c�j�|jt�5tj�ddd�|j	tjdd�d�|j	tjdd��d�|j	tjdddd�d�y#1swY�xYw)NrYr�)rYr�r0r8rOrJ)rYr�)rOrJ)r!r�r��posonly_varargr�rEs r�test_posonly_varargz(ClinicFunctionalTest.test_posonly_varargs���
�
�
�y�
)��$�$�&�*�����1�1�!�Q�7��D�����1�1�!�q�9�:�F�����1�1�!�Q��1�=�~�N�	*�
)�s�B)�)B2c�R�|jt�5tj�ddd�|jt�5tjdd��ddd�|j	tjdddd�d�y#1swY�gxYw#1swY�>xYw�NrYr�r8rOrJ)rY�r�rOrJ)r!r�r��vararg_and_posonlyr�rEs r�test_vararg_and_posonlyz,ClinicFunctionalTest.test_vararg_and_posonly!su��
�
�
�y�
)��(�(�*�*�
�
�
�y�
)��(�(��a�0�*�����5�5�a��A�q�A�>�R�	*�
)��
)�
)���B�B�B�B&c�R�|jt�5tj�ddd�|jt�5tjdd��ddd�|j	tjdddd�d�y#1swY�gxYw#1swY�>xYwr�)r!r�r��varargr�rEs r�test_varargz ClinicFunctionalTest.test_vararg(su��
�
�
�y�
)�����*�
�
�
�y�
)����Q�!�$�*�����)�)�!�Q��1�5�~�F�	*�
)��
)�
)�r�c	��tj}|jt|�|jt|dd��|j	|dd��d�|j	|dddd�d�|j	|ddddd	��d
�|j	|d��d�|j	|dd��d�y)
NrYr�r�r8)rYr0TrOrJ)rYr�Fr�)rYr�T)rYr0Fr�)r��vararg_with_defaultr!r�r�r�s  r�test_vararg_with_defaultz-ClinicFunctionalTest.test_vararg_with_default/s���
�
*�
*�����)�R�(����)�R��a��0�����A���]�3�����A�q�!�Q��)>�?�����A�q�!�Q�!�,�.B�C�����a��.�1�����a�1��}�5rc	�.�tj}|jt|�|jt|dd��|j	|dd��d�|j	|ddd��d�|j	|ddd�d	�|j	|dddd
��d�|j	|dddd
d��d
�|j	|d��d�|j	|dd��d�|j	|ddd��d�y)NrYr�r�r8)rYr0r�NrOrY)rYr0r�rO)rY�r�rONNrJ)rYr�rJNr�)rYr�rJr�)rYr0NNr�r�)r��vararg_with_default2r!r�r�r�s  r�test_vararg_with_default2z.ClinicFunctionalTest.test_vararg_with_default29s���
�
+�
+�����)�R�(����)�R��a��0�����A���%5�6�����A��a��-�8�����A�q�!��&=�>�����A�q�!�q�)�+?�@�����A�q�!�q�A�.�0A�B�����a��"5�6�����a�1��'7�8�����a�1��*�M�:rc	��|jtj�d�|jtjd��d�|jtjdd��d�|jtjdddd�d	�|jtjddddd
��d�y)N)r0Nr�r8)r0r�rY)r{r�rOrJ)rLNr�)rLr�)r�r��vararg_with_only_defaultsrEs r�test_vararg_with_only_defaultsz3ClinicFunctionalTest.test_vararg_with_only_defaultsFs�������<�<�>�
�K�����<�<�q�A�7�K�����<�<�Q�!�D�j�Q�����<�<�Q��1�a�H�J^�_�����<�<�Q��1�a�1�M�O`�arc�:�tjdddddd��y)NrYr�rOrJr��)�kw1�kw2)r��gh_32092_oobrEs r�test_gh_32092_oobz&ClinicFunctionalTest.test_gh_32092_oobMs�����q�!�Q��q�a�8rc�2�tjddd�y)NrYr�rO)r��gh_32092_kw_passrEs r�test_gh_32092_kw_passz*ClinicFunctionalTest.test_gh_32092_kw_passPs���"�"�1�a��+rc��d}tj|�}tj|�tj|�}|j	||�y)Nz5*A unique string is not referenced by anywhere else.*)rj�getrefcountr��gh_99233_refcountr�)r$�arg�arg_refcount_origin�arg_refcount_afters    r�test_gh_99233_refcountz+ClinicFunctionalTest.test_gh_99233_refcountSsE��E��!�o�o�c�2���#�#�C�(� �_�_�S�1�����,�.@�Arc��d}|jt|�5tjdd�ddd�y#1swYyxYw)NzVgh_99240_double_free\(\) argument 2 must be encoded string without null bytes, not strr�zb)r�r�r��gh_99240_double_free)r$�expected_errors  r�test_gh_99240_double_freez.ClinicFunctionalTest.test_gh_99240_double_freeZs3��r��
�
#�
#�I�~�
>��*�*�3��6�?�
>�
>�s	�9�Ac��d}|jtd�5tj|�ddd�|jtd�5tj|�ddd�y#1swY�>xYw#1swYyxYw)Nr��clone_f1�clone_f2)r�r�r�r�r�)r$�
incorrect_args  r�"test_cloned_func_exception_messagez7ClinicFunctionalTest.test_cloned_func_exception_message_s`���
�
�
#�
#�I�z�
:����}�-�;�
�
#�
#�I�z�
:����}�-�;�
:�;�
:��
:�
:�s�A,�
A8�,A5�8Bc��dD]D}|j|��5tt|�}|j|�|�ddd��Fy#1swY�QxYw)N)�clone_with_conv_f1�clone_with_conv_f2r;)r�r�r�r�)r$r4�funcs   r�1test_cloned_func_with_converter_exception_messagezFClinicFunctionalTest.test_cloned_func_with_converter_exception_messagefsG��>�D����4��(��y�$�/��� � ����.�)�(�?�(�(�r�c��tj�}|j}t|jt
d�}||d�||d��y)N�no argumentsrYr�)r��	TestClass�meth_method_no_paramsrr�r�)r$�obj�meth�checks    r�test_meth_method_no_paramsz/ClinicFunctionalTest.test_meth_method_no_paramslsB���!�!�#���(�(����.�.�	�>�J��
�d�A��
�d�a�rc��ddlm}tj�}|j}||dd�||dd�||dd�||dd�t|jtd�}|||dd�|||dd�y)Nr)�pyobject_vectorcallr0r�r{r�)r�r�r�r�r�rr�r�)r$r�r�r�r�s     r�test_meth_method_no_params_capiz4ClinicFunctionalTest.test_meth_method_no_params_capiss���1��!�!�#���(�(���D�$��-��D�"�d�+��D�"�b�)��D�$��+���.�.�	�>�J��
�!�4��t�4�
�!�4��v�6rN)=r,r-r.�localsr�dirr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr r$r)r.r1r6r:r=rErNrQrTrWr[r_rcrfrirqrvryr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r0rrr�r��s\��
�H�O�O�L� #�I��L�L�D�^�
W�O�
c�
E�j�	C�k�O�h�	D�j�	I�p�	Q�	K�>�C�D�D�	Y�	g�p�
?�
F�K�Z�R�E�C�T�
Y�
C�	=�Y�f� j� 
F�F�O�S�G�6�;�b�9�,�B�7�
.�/��7rr�c�"�eZdZdZd�Zd�Zd�Zy)�PermutationTestsz#Test permutation support functions.c��d}ttgd���}ttj|��}|j||�y)N)r0)rOr�r4r4)rrzr�r�permute_left_option_groupsr��r$r��datars    r�test_permute_left_option_groupsz0PermutationTests.test_permute_left_option_groups�s>��
���C�	�N�#���v�8�8��>�?�������*rc��d}ttgd���}ttj|��}|j||�y)N)r0r{r�r4r4)rrzr�r�permute_right_option_groupsr�r�s    r� test_permute_right_option_groupsz1PermutationTests.test_permute_right_option_groups�s>��
���C�	�N�#���v�9�9�$�?�@�������*rc	��ddddd�}ddddd�}dddd	d�}ddd
dd�}dddd
d�}ddddd�}ddddd�}ddddd�}ddddd�}	|||||||||	f	}
|
D]f}|jdi|��5|j�\}}
}}tj||
|�}t	|�}|j||�ddd��hy#1swY�sxYw)Nr0)r0)�left�required�rightr�r8rA)r8rYrYrs)rYr]rt)rYr])r�r�rhrnr�)r8r�)rYr�r�)rArYr�)r8r�r�ra)rnr)rar]rK)r�r�r�rhrn)r�r�r�rhrnr)r�r�rr�r�r�)r$�empty�noleft1�noleft2�noleft3�noright1�noright2�noright3�
leftandright1�
leftandright2r~r�r�r�r�r��permutationsrs                  r�test_permute_optional_groupsz-PermutationTests.test_permute_optional_groups�sH���B���
��
�F�V��
���K�&��
���K�*��
������
���
�R��
���F�R��
������
�
��J���	
�
�
��W�g��h���=�	
���F�����'��'�28�-�-�/�/��h��x�%�=�=�d�H�e�T���|�,��� � ���2�	(�'��'�'�s
�"A
B7�7C	N)r,r-r.�__doc__r�r�r�r0rrr�r��s��-�	+�	+�N3rr�c�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�FormatHelperTestsc��d}|D]H\}}|j||��5tj|�}|j||�ddd��Jy#1swY�UxYw)N)	)�a
br�)za
b
r�)za
b r�)z
a
b

r�)z

a
b

r�)z

a

b

za

b)� a
br�)z a
b r�)z
 
 
 a
b 
 
 r�)r~r�)r�r�&strip_leading_and_trailing_blank_linesr�)r$r~r~r�r�s     r�+test_strip_leading_and_trailing_blank_linesz=FormatHelperTests.test_strip_leading_and_trailing_blank_lines�sX��
�� '�O�E�8����E�H��=��C�C�E�J��� � ��h�/�>�=� '�=�=���(A�A	c���d}d}d}d}|||d�}|j�D]I\}}|j|��5tj||��}|j	||�ddd��Ky#1swY�VxYw)Nz;
            one
            two
            three
        z
one
two
threez    one
    two
    threez%        one
        two
        three)rrJ�)�indent)�itemsr�r�normalize_snippetr�)	r$�snippet�zero_indent�four_indent�eight_indent�expected_outputsr�r�rs	         r�test_normalize_snippetz(FormatHelperTests.test_normalize_snippet	s�����
�	�
�	�
�	�
 +�{�|�L�� 0� 6� 6� 8��F�H����V��,��1�1�'�&�I��� � ���2�-�,�!9�,�,�s�*A,�,A5	c�t�tj�}|j|j�d�|j	d�|j|j�d�|j|j�d�|j	d�|j|j�d�|j|j�d�|j	d�|j	d�|j|j�d�|j|j�d�y)NrPr�r�r�rh�cd)r�text_accumulatorr�r��append)r$�accs  r�test_accumulatorz"FormatHelperTests.test_accumulator	s����%�%�'���������r�*��
�
�3���������s�+��������r�*��
�
�3���������s�+��������r�*��
�
�3���
�
�3���������t�,��������r�*rc��d}|D]H\}}|j||��5tj|�}|j||�ddd��Jy#1swY�UxYw)N))r3r3)z\abcz\\abc)z\a\bcz\\a\\bc)z\a\\bcz	\\a\\\\bc)z"abc"z\"abc\")z'a'z\'a\')rr�)r�r�quoted_for_c_stringr�)r$r~rr�r�s     r�test_quoted_for_c_stringz*FormatHelperTests.test_quoted_for_c_string+	sX��
��&�N�D�(����4�(��;��0�0��6��� � ��h�/�<�;�&�;�;�r�c�Z�d}d}tj|�}|j||�y)Nza 
b
 c
 d 
z
a
b
 c
 d
)r�rstrip_linesr��r$r~r�r�s    r�test_rstrip_linesz#FormatHelperTests.test_rstrip_lines:	s8��
�	�
�	��!�!�%�(������h�'rc�Z�d}d}tj|�}|j||�y)Nz{}, {a}z{{}}, {{a}})r�
format_escaper�)r$rr�r�s    r�test_format_escapez$FormatHelperTests.test_format_escapeJ	s,���� ���"�"�4�(������h�'rc��|jtjdd��d�d}d}tj|d��}|j||�d}d}tj|d��}|j||�y)NrP�bar)�prefix�one
twoz
barone
bartwo�	
one
two
zbar
barone
bartwo
)r�r�indent_all_linesr�s    r�test_indent_all_linesz'FormatHelperTests.test_indent_all_linesP	�������0�0��E�B�B�G�
�	�

�	��%�%�e�E�:������h�'�
�	�
�	��%�%�e�E�:������h�'rc��|jtjdd��d�d}d}tj|d��}|j||�d}d}tj|d��}|j||�y)NrP�foo)�suffixr�z
onefoo
twofoorzfoo
onefoo
twofoo
)r�r�suffix_all_linesr�s    r�test_suffix_all_linesz'FormatHelperTests.test_suffix_all_lineso	rrN)r,r-r.r�r�r�r�r�r�rrr0rrr�r��s*��0�&3�:+�
0�(� (�(�>(rr��__main__)2�	functoolsr�testrr�test.supportr�test.support.os_helperrr�textwrapr	�unittestr
r_ro�os.pathr1rrj�skip_if_missing�imports_under_toolrrrrrr2r9rBrwr�rNrzr�r�rrrr*r�_testclinicr��ImportError�skipIfr�r�r�r,�mainr0rr�<module>rs���
�$�"�1�������
���
���8�$�"�Z�"�"�8�,�� �-�
&�
9�
G�(�
G���0�0�Q�Q��F�M�M�3�6�2��-8�-8�`d �+�d �N-*�h�-*�`2&�X�2&�h
�
�#�#�:�H�:�zi
+�{�i
+�XE ��E �P�#������d�"�$<�=�s7�8�,�,�s7�>�s7�lg3�x�(�(�g3�Ta(��)�)�a(�H�z���H�M�M�O��yK-�,��h3���I��s�%F�F�F�F&�%F&

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists