HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_clinic.cpython-312.opt-2.pyc
�

h�e�M��F�ddlmZddlmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlZddlZddlZddlZddlZddlZej(d�ej*d�5ddlZdd	lmZddd�Gd
�de
�ZGd�d
�ZGd�d�ZGd�d�Zej8dd��ZGd�d�ZGd�de�ZGd�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jTe(dud'�Gd(�d)ej��Z+Gd*�d+ej�Z,Gd,�d-ej�Z-e.d.k(rej^�yy#1swY��xYw#e)$rdZ(Y��wxYw)/�)�partial)�support�
test_tools)�	os_helper)�TESTFN�unlink)�dedent)�TestCaseN�clinic)�	DSLParserc��eZdZdZd�Zd�Zy)�_ParserBaseNc��tj�5}|jt�5||�ddd�ddd�|j	�S#1swY�!xYw#1swYj	�SxYw�N)r�captured_stdout�assertRaises�
SystemExit�getvalue)�self�parser�_input�stdouts    �7/opt/alt/python312/lib64/python3.12/test/test_clinic.py�expect_parser_failurez!_ParserBase.expect_parser_failuresh��
�
$�
$�
&�	�&��"�"�:�.�
��v��
�	���� � �
�
��	���� � �s!�A �	A�A �A	�A � A8c�:�|j|j|�Sr)r�parse_function)rrs  r�parse_function_should_failz&_ParserBase.parse_function_should_fail!s���)�)�$�*=�*=�v�F�F�)�__name__�
__module__�__qualname__�maxDiffrr�rrrrs���G�!�Grrc��eZdZd�Zy)�
FakeConverterc� �||_||_yr)�name�args�rr'r(s   r�__init__zFakeConverter.__init__&s����	���	rN)rr r!r*r#rrr%r%%s��rr%c��eZdZd�Zd�Zy)�FakeConverterFactoryc��||_yr�r'�rr's  rr*zFakeConverterFactory.__init__,s	����	rc�.�t|j|�Sr)r%r')rr'�default�kwargss    r�__call__zFakeConverterFactory.__call__/s���T�Y�Y��/�/rN)rr r!r*r3r#rrr,r,+s���0rr,c��eZdZd�Zd�Zy)�FakeConvertersDictc��i|_yr)�used_converters�rs rr*zFakeConvertersDict.__init__4s
��!��rc�L�|jj|t|��Sr)r7�
setdefaultr,)rr'r1s   r�getzFakeConvertersDict.get7s!���#�#�.�.�t�5I�$�5O�P�PrN)rr r!r*r;r#rrr5r53s
��"�Qrr5�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�rA�block�bufferr=�suppress�docstring_prototype�docstring_definition�methoddef_define�impl_prototype�parser_prototype�parser_definition�impl_definition)r5�
converters�legacy_convertersr�	CLanguager>r?�destination_buffers�BlockParser�block_parser�collections�OrderedDict�modules�classesr'�line_prefix�line_suffix�destinations�add_destinationr;�field_destinations)r�ds  rr*zFakeClinic.__init__=sD��,�.���!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: )rZr;�sys�exit�repr)rr'r]s   r�get_destinationzFakeClinic.get_destinationXs6�����!�!�$�'����H�H�3�d�4�j�@�A��rc��||jvr!tjdt|�z�t	j
|||g|���|j|<y)NzDestination already exists: )rZr_r`rar�Destination)rr'�typer(s    rr[zFakeClinic.add_destination^sJ���4�$�$�$��H�H�3�d�4�j�@�A�"(�"4�"4�T�4��"M��"M����$�rc��|dk(S)N�moduler#r/s  r�is_directivezFakeClinic.is_directivecs
���x��rc�"�||j|<yr)�called_directivesr)s   r�	directivezFakeClinic.directivefs��'+����t�$rN)rr r!r*rbr[rhrkr�Clinic�_module_and_classr#rrrArA<s.���6�N�
 �,��
�
�7�7�rrAc�r�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�ClinicWholeFileTestc�b�tjtjd�d��|_y)N�test.c�r?)rrlrPr8s r�setUpzClinicWholeFileTest.setUpms���m�m�F�$4�$4�T�$:�X�N��rc��t|�j�}|j|jj|�Sr)r	�striprr�parse)r�rawrs   r�expect_failurez"ClinicWholeFileTest.expect_failureps1�����"�"�$���)�)�$�+�+�*;�*;�V�D�Drc���d}|jj|�j�}|dj�}|j	|d�|j|d�y)Nz/*[clinic]
foo
[clinic]*/�z[clinic]*/[clinic]*/z
[clinic]*/)rrv�
splitlines�rstrip�assertNotEqual�assertEqual)rrw�cooked�end_lines    r�test_eolzClinicWholeFileTest.test_eolts[��,�����"�"�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]*/'
�rxr~�rrw�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
�rx�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]rqrrz\
            //[clinic start]
            //module test
            //[clinic stop]
        z�
            //[clinic start]
            //module test
            //
            //[clinic stop]
            /*[clinic end generated code: output=da39a3ee5e6b4b0d input=65fab8adff58cf08]*/
        )rrP�body_prefix�
start_line�	stop_linerlr	rurv�lstripr~)r�clang�clrwr��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_if�s3����
?�	��!�!�#�&������c�"rc�N�|jd�}d}|j||�y)Nzy
            /*[clinic input]
            output preset nosuchpreset
            [clinic start generated code]*/
        zUnknown preset 'nosuchpreset'r��rr�r�s   r�$test_directive_output_unknown_presetz8ClinicWholeFileTest.test_directive_output_unknown_preset�s,���!�!�#�
��
.���
�
�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_endifrJrMrI�methoddef_ifndefrKrLrGrH)�field�
���z%/*[clinic end generated code: output=)	r	rrv�
assertTrue�
startswith�subTestr�r|�split)rrwr��fieldsr��	last_lines      r�test_directive_output_printz/ClinicWholeFileTest.test_directive_output_prints�����
��
�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_command4s,���!�!�#�
��
<���
�
�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_init=s2���!�!�#�
��
K�	�	
�
�
�c�3�rN)rr r!rsrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#rrrorolsZ��O�E�1�"#�
 �
#�
#�(�*#�#�#�#� � �!
�F � rroc�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._testSs&���1�1�!�Q��:�������*rc�6�|jdggdgdggd�y)N�start�stop�step))r�)r�r�)r�r�r��r�r8s r�
test_rangez"ClinicGroupPermuterTest.test_rangeWs#���
�
�W�I�;���F�8�*��	
rc�8�|jddggdgdggd�y)N�x�y�ch�attr))r�)r�r�)r�r�r�)r�r�r�r�r�r8s r�test_add_windowz'ClinicGroupPermuterTest.test_add_window_s%���
�
�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�r8s r�test_ludicrousz&ClinicGroupPermuterTest.test_ludicroushs/���
�
�&��t��5��v��t��N`�?a��	
rc�8�|jggdgdgdggd�y)N�a�b�c)r#�r��r�r��r�r�r�r�r8s r�test_right_onlyz'ClinicGroupPermuterTest.test_right_onlyss&���
�
�2�r�S�E�3�%���.��	
rc�6�d�}|jt|�y)Nc�4�tjdggg�y)Nr�)rr�r#rr�fnzPClinicGroupPermuterTest.test_have_left_options_but_required_is_empty.<locals>.fn}s���*�*�C�5�"�b�9r)r�
ValueError)rr�s  r�,test_have_left_options_but_required_is_emptyzDClinicGroupPermuterTest.test_have_left_options_but_required_is_empty|s��	:����*�b�)rN)	rr r!r�r�r�r�r�r�r#rrr�r�Rs ��+�
�
�	
�
�*rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�ClinicLinearFormatTestc�T�tj|fi|��}|j||�yr)r�
linear_formatr~)r�inputr�r2r�s     rr�zClinicLinearFormatTest._test�s'���'�'��8��8�������*rc�(�|jdd�y)NrCr�r8s r�test_empty_stringsz)ClinicLinearFormatTest.test_empty_strings�s���
�
�2�r�rc�(�|jdd�y)Nr�r�r8s r�test_solo_newlinez(ClinicLinearFormatTest.test_solo_newline�s���
�
�4��rc�(�|jdd�y)Nz
          abc
        r�r8s r�test_no_substitutionz+ClinicLinearFormatTest.test_no_substitution�s���
�
���	
rc�,�|jddd��y)N�6
          abc
          {name}
          def
        z%
          abc
          def
        rCr.r�r8s r�test_empty_substitutionz.ClinicLinearFormatTest.test_empty_substitution�s"���
�
����	�	rc�,�|jddd��y)Nr�z6
          abc
          GARGLE
          def
        �GARGLEr.r�r8s r�test_single_line_substitutionz4ClinicLinearFormatTest.test_single_line_substitution�s"���
�
����	�	rc�,�|jddd��y)Nr�zH
          abc
          bingle
          bungle

          def
        zbingle
bungle
r.r�r8s r�test_multiline_substitutionz2ClinicLinearFormatTest.test_multiline_substitution�s"���
�
���%�	�
	&rN)
rr r!r�r�r�r�r�r�r�r#rrr�r��s%��+���
��	�&rr�c��eZdZd�Zd�Zy)�InertParserc��yrr#�rrs  rr*zInertParser.__init__����rc��yrr#�rrDs  rrvzInertParser.parse�r�rN�rr r!r*rvr#rrr�r��s��
�
rr�c��eZdZd�Zd�Zy)�
CopyParserc��yrr#r�s  rr*zCopyParser.__init__�r�rc�&�|j|_yr)r�r�rs  rrvzCopyParser.parse�s
���{�{��rNrr#rrrr�s��
�#rrc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�ClinicBlockParserTestc��tjd�}ttj||��}tj|�}|D]}|j|��|jj�}yr)rrP�listrR�BlockPrinter�print_block�fr)rr�r�r>�blocks�writerrDs       rr�zClinicBlockParserTest._test�sh���#�#�D�)���f�(�(���9�:���$�$�X�.���	&�E����u�%�	&����"�"�$�rc�&�|j||�Srr�)rr�s  r�
round_tripz ClinicBlockParserTest.round_trip�s���z�z�%��'�'rc�&�|jd�y)Nz@
            verbatim text here
            lah dee dah
        �rr8s 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
rr8s r�test_round_trip_2z'ClinicBlockParserTest.test_round_trip_2�s�����	�		rc��tjd�}tj|d��}t|�|jd<t|�|jd<|j
|�}|j||�y)Nr=rr�inert�copy)rrPrlr��parsersrrvr~)rr�r�r>r�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
)rr8s r�
test_clinic_1z#ClinicBlockParserTest.test_clinic_1�s�����	�	�	rN)	rr r!r�rrrrrr#rrrr�s!��k�(�
�

�+�rrc�d�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�Z9d;d8�Z:d9�Z;y:)<�ClinicParserTestc��|jt|d��|j|jj	�t|�j	��y)N�	docstring)r��hasattrr~r!rur	)rr�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rAr�Blockrv�
signaturesr~r')rrrDrg�functions     r�test_trivialzClinicParserTest.test_trivialsg���:�<�(������
��	���U�� �+�+��������8�=�=�1�����v�{�{�+rc���|jtd��}|j\}}|jd|j�|jd|j�y)NzC
            #
            module os
            os.access
        r%r&)rvr	r(r~r')rrDrgr)s    r�test_ignore_linez!ClinicParserTest.test_ignore_linesV���
�
�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
        r%rz�path)	rr~r'�len�
parameters�assertIsInstance�	converterr�
int_converter�rr)�ps   r�
test_paramzClinicParserTest.test_params����&�&�(�
��
	
����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�rr0r~r1r4s   r�test_param_defaultz#ClinicParserTest.test_param_default)s>���&�&�(�
��

��� 1�2������q�y�y�)rc�|�|jd�}|jd}|jd|j�y)Nz�
            module os
            os.access
                follow_symlinks: \
                bool \
                = \
                True
        r8Tr9r4s   r�test_param_with_continuationsz.ClinicParserTest.test_param_with_continuations2s>���&�&�(�
��
��� 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
            r8�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
        )	rr0r~r_�maxsizer1r2�	c_defaultr)rr)r5�expected_msgr�s     r�test_param_default_expressionz.ClinicParserTest.test_param_default_expression>s����&�&�(���

��� 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)rr~r/r0r2r1r�
str_converter)rr)�convs   r�test_param_no_docstringz(ClinicParserTest.test_param_no_docstringTsa���&�&�(�
��	
����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�rr~�rrAr�s   r�*test_param_default_parameters_out_of_orderz;ClinicParserTest.test_param_default_parameters_out_of_order_s5��
2�	�
�-�-�/'�(��
	
����l�+rc��|jd�}|jd}|jd|jjd�y)Nz^
            module os
            os.access
                path: path_t(allow_fd=1)
        r.��allow_fd)rr0r~r2r(r4s   r�!disabled_test_converter_argumentsz2ClinicParserTest.disabled_test_converter_argumentslsH���&�&�(�
��

����'������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
        �rr#�rr)s  r�test_function_docstringz(ClinicParserTest.test_function_docstringu�.���&�&�(�
��	
���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.
        �rr	r#rSs  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!
        rWrSs  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)rr~�
c_basenamerSs  r�test_c_namezClinicParserTest.test_c_name�s/���&�&�(�
��	
����x�':�':�;rc�z�|jd�}|j|jtj�y)Nz:
            module os
            os.stat -> int
        )rr1�return_converterr�int_return_converterrSs  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
        r8r)rr0r~�inspect�	Parameter�KEYWORD_ONLY�kind�groupr4s   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
                ]
                /
        �lsrN)rr0r~rhr4s   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�rN�r'rha
            addch([y, x,] ch, [attr])


              y
                Y-coordinate.
              x
                X-coordinate.
              ch
                Character to add.
              attr
                Attributes for the character.
        �
rr�r0r~rhrgrdre�POSITIONAL_ONLYr#�rr)�datasetr'rhr5s      r�test_left_groupz ClinicParserTest.test_left_group�s����&�&�(�
��"
��
#�	L�K�D�%����4�u��5�
L��'�'��-��� � ����%�0�� � �����):�):�)J�)J�K�
L�
L�	L�
	
���H�'�	
�	
L�
L���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���)�y2rx)�x1r�)�x2r�rn)�attr1rN)�attr2rN)�attr3rN)�attr4rz)�attr5rz)�attr6rzroa�
            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.
        rprrs      r�test_nested_groupsz#ClinicParserTest.test_nested_groups�s����&�&�"(�"
��F
��#�	L�K�D�%����4�u��5�
L��'�'��-��� � ����%�0�� � �����):�):�)J�)J�K�
L�
L�	L�	
���H�'�	
�
L�
L�ruc��tj�5}|jt�5|j	|�ddd�ddd�|j�S#1swY�!xYw#1swYj�SxYwr)rrrrrr)r�srs   rrz+ClinicParserTest.parse_function_should_failLso��
�
$�
$�
&�	'�&��"�"�:�.�
'��#�#�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
        rJrKs   r�0test_disallowed_grouping__two_top_groups_on_leftzAClinicParserTest.test_disallowed_grouping__two_top_groups_on_leftRs5��
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)�rr�r�s   r�1test_disallowed_grouping__two_top_groups_on_rightzBClinicParserTest.test_disallowed_grouping__two_top_groups_on_righte�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_rightwr�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, /)
--

DocstringrN�rr~r!r/r0rSs  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

        rDrz)�signatures_in_block�function_indexzBar()
--

DocstringrNr�rSs  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��rr�s  r�test_single_starz!ClinicParserTest.test_single_star�s(���-�-�/�
��	
�
�
�=�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.�rD)r�rr�)rrsr�rDr�s     r�#test_parameters_required_after_starz4ClinicParserTest.test_parameters_required_after_star�sf��
��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_slashs,���-�-�/�
��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_slash$s1���-�-�/�
��
$�	�	
�
�
�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_now4r�rc�N�d}|jd�}|j||�y)Nz#Error on line 0:
Too many var args
zt
            module foo
            foo.bar
               *vararg1: object
               *vararg2: object
        rJrKs   r�'test_parameters_no_more_than_one_varargz8ClinicParserTest.test_parameters_no_more_than_one_varargAs5��
"�	��-�-�/�
��	
����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.
        rRrSs  r�test_function_not_at_column_0z.ClinicParserTest.test_function_not_at_column_0NrUrc�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_tabsbs,���-�-�/�
��>���
�
�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_outdentls(���-�-�/�
��	
�
�
�'��-rc����t�}t|��d�_�fd��jd<t	j
d�}�j
|�|j�j�y)NFc���t�dd�S)N�flagT)�setattr)rs�r�<lambda>z1ClinicParserTest.test_directive.<locals>.<lambda>ys�������0M�r�setflag)rArr��
directivesrr'rvr�)rr�rDrs   @r�test_directivezClinicParserTest.test_directiveusT����L���1������'M����)�$����Y�'�����U��������$rc��|jd�}|j\}}|jdj}|j	|t
j�y)Nz module os
os.access
   path: "s"r.)rvr(r0r2r1rrF)rrDrgr)rGs     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�rr~�r�expected_failure_messagersrDr�s     r�5test_legacy_converters_non_string_constant_annotationzFClinicParserTest.test_legacy_converters_non_string_constant_annotation�su��
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�su��
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_msgrsr�r�s     r�9test_kwarg_splats_disallowed_in_function_call_annotationszJClinicParserTest.test_kwarg_splats_disallowed_in_function_call_annotations�sn��
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 *")
        rJ�rr�rDr�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
        rJr�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
        rJr�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
        rJr�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)rrDr�s   r�.test_slot_methods_cannot_access_defining_classz?ClinicParserTest.test_slot_methods_cannot_access_defining_class�sD����A��
�
#�
#�J��
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__
        rJ�rr�r�s   r�test_new_must_be_a_class_methodz0ClinicParserTest.test_new_must_be_a_class_method�s6��
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__
        rJr�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
        rNc�"���|jSr�r2)r��paramss �rr�z4ClinicParserTest.test_unused_param.<locals>.<lambda>s���&��*�.�.�rr�F)r'�unused�k�iTr�)�	in_parser�	Py_UNUSED)
rvr(r0�valuesr�r~r��simple_declarationr��assertNotIn)rrD�sigrGrs�paramr'r�r5�decl�parser_declr�s           @r�test_unused_paramz"ClinicParserTest.test_unused_params����
�
�	�	
�����q�!������.���U�+��E�*��D�)��t�,�	
���	;�E� �<�<�>�L�D�&����4���7�
;���J��� � �����2��+�+�e�+�<����M�M�+�t�4��$�$�[�$�7� �2�2�T�2�B��� � ��k�:�
;�
;�	;�
;�
;�s
�0BC=�=D	c�|�t�}t|�}tj|�}|j	|�|Sr)rArrr'rv)r�textr�rrDs     rrvzClinicParserTest.parse7s1���L���1������T�"�����U���rc�|�|j|�}|j}|jt|�|�||Sr)rvr(r~r/)rr�r�r�rDr�s      rrzClinicParserTest.parse_function>s=���
�
�4� ����������Q��!4�5��� � 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)r?�line_number)r~rar�unspecified�NULLrrrr�failr)rr�r�actuals    r�test_scaffoldingz!ClinicParserTest.test_scaffoldingFs�������f�0�0�1�?�C�����f�k�k�*�H�5�
(�	��
$�
$�
&�	B�&��"�"�:�.�
B����5�%0�b�B�
B�	B����"�������*�	
B�
B��	B�	B�s$�)C�?C�C�C	�C�C N)rzrN)<rr r!r#r*r,r6r:r<rBrHrLrPrTrXrZr^rbrirlrtr�rr�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�rvrr�r#rrrrs(��3�
	,�,�
A�*�
*�,�,	:�,�:�
�(
�0
�<�V�	%�
%�(
�TL
�\!�,�& �$ �$ �$ �" �"
 �	6�
6� � �D�(� �
 � �  �,�
�( �.�%�:�@� 
@�:� 
2�2�2� 2�
'�
2�2�$;�L�!�+rrc��eZdZdZej
j
ejdd�Z	dd�d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ClinicExternalTestNrz	clinic.pyT)�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�stderrrC)�
subprocess�Popenr_�
executable�	clinic_py�PIPE�wait�
returncoder��joinrr�readr~)rr�r(�procrrs      r�_do_testzClinicExternalTest._do_test\s���
�
�
�
�^�^�X�t�~�~�=��=����?�?��?�?�
�	���I�I�K��$�/�/��	�	�"�'�'�">�D�K�K�">�$�+�+�">�?�@��[�[�%�%�'�F��[�[�%�%�'�F����V�R�(��	�	�	�s
�BC<�<Dc� �|j|�Sr�r�rr(s  rr�z!ClinicExternalTest.expect_successms���t�}�}�d�#�#rc�&�|j|ddi�S)Nr�Frrs  rrxz!ClinicExternalTest.expect_failureps���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�-orC)	r�findfile�openr
�
addCleanuprrr�r~)r�CLINIC_TEST�sourcer
�
orig_contentsr��new_contentss       r�
test_externalz ClinicExternalTest.test_externalss���%���!�!�+�.��
�&�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]*/
        rq�wrr)r	r�temp_dirr&r.rr�write�stat�st_mtime_nsr�r~)r�code�tmp_dirr�r
�	pre_mtime�
post_mtimes       r�test_no_changez!ClinicExternalTest.test_no_change�s�����
��
�
�
�
!�	1�W������g�x�0�B��b�#��0�
�A�����
�
������/�/�I�����#������0�0�J�
	1�	
����J�/�
�
��	1�	1�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.
        rqr!rrrrCzP/*[clinic end generated code: output=2124c291eb067d76 input=9543a8d2da235301]*/
)r	rr"r&r.rrr#rxr��endswithr�r~r
)	r�
invalid_input�fail_msgr'r�r
r��checksum�	generateds	         r�test_cli_forcez!ClinicExternalTest.test_cli_force�s(���
 �

�
���
���
�
�
!�	:�W������g�x�0�B��b�#��0�
'�A����
�&�
'�
�%�%�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�'	:�	:�
'�
'��
%�
%��#	:�	:�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)Nr!rr)r&r.rrr#)�files�srcdirr&r�r.r
s      r�create_filesz6ClinicExternalTest.test_cli_make.<locals>.create_files�sX���
"���w�w�|�|�F�B�/���$��g�6�"�!��G�G�D�M�"�"�
"�"�"�s�A�A	�	externals)r.�-v�--make�--srcdirrr)
r	rr"r&r.rr�r�r�r�)r�c_code�py_code�c_files�py_filesr7r'�ext_pathr8r�r?r.s            r�
test_cli_makez ClinicExternalTest.test_cli_make�s�����
����&��)��	"��
�
�
!�	0�W���'�6�2���7�G�4��w�w�|�|�G�[�9�H��#�#��2�
O�i��W�i��8��)�)�$��*�g�N��	
O�$�
-���\�\�8�\�4�-��7�7�<�<���:�D��M�M�$��,�-�-�
-�%�
0���\�\�8�\�4�0��7�7�<�<���:�D��$�$�T�3�/�0�0�
0�
$�
0���\�\�8�\�4�0��7�7�<�<��(�;�D��$�$�T�3�/�0�0�
0�/	0�	0�
O�
O��-�-��0�0��
0�0��1	0�	0�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)Nrqr!rrrCr9)
rr"r&r.rrr#r�r~ru)rr'r�r
r�s     r�test_cli_verbosez#ClinicExternalTest.test_cli_verbose�s���
�
�
�
!�	.�W������g�x�0�B��b�#��0�
�A������
��%�%�d�B�/�C����S�Y�Y�[�"�-�	.�	.�
�
��	.�	.�s#�/B%�B�:B%�B"	�B%�%B.c�J�|jd�}|jd|�y)Nz-h�usage: clinic.py)r�r�r�s  r�
test_cli_helpz ClinicExternalTest.test_cli_help�s!���!�!�$�'���
�
�(�#�.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	r�r�r�r,�removeprefix�removesuffixr��zipr�r�)r�prelude�expected_converters�finaler��linesr2�lines        r�test_cli_convertersz&ClinicExternalTest.test_cli_converters�s����
��
��<��
�� �!�!�.�1��
	
������w�/��5�������V�,�c�2����w�'�����v�&���	�	�$���"�#6��>�	�O�I�t��;�;�=�D����	��2�
�����O�O�I�.�)�)��f�T�H�E��
�
�	�
�
�s�(D�D	c�P�|jdd�}d}|j||�y)NrcrqzGUsage 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_filename?s.���!�!�.�(�;��
.�	�	
�
�
�c�3�rc�H�|j�}|jd|�y)NrEr�r�s  r�test_cli_fail_no_filenamez,ClinicExternalTest.test_cli_fail_no_filenameGs���!�!�#���
�
�(�#�.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_filesKs+���!�!�$���M�J��A���
�
�c�3�rc��dD]D}|j|��5|jdg|���}d}|j||�ddd��Fy#1swY�QxYw)N))rrr)z
filename.c)�optsr:z2Usage error: can't use -o or filenames with --make)r�rxr�)rrur�r�s    r�)test_cli_fail_filename_or_output_and_makez<ClinicExternalTest.test_cli_fail_filename_or_output_and_makePsc��4�	(�D����4��(�
(�)�d�)�)�(�:�T�:��J���
�
�c�3�'�
(�
(�	(�
(�
(���(A�A	c�R�|jddd�}d}|j||�y)Nr:r;rCz3Usage error: --srcdir must not be empty with --maker�r�s   r�!test_cli_fail_make_without_srcdirz4ClinicExternalTest.test_cli_fail_make_without_srcdirWs)���!�!�(�J��;��C���
�
�c�3�r)rr r!r"r&r.rr�toolsdirrrr�rxrr*r1rArCrFrlrnrprsrvryr#rrr�r�Xsu���G������Z�0�0�(�K�H�I�-1��"$�:�6� 0�(&:�P)0�V.�/�G�R �/� �
(� rr�z_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;y7)8�ClinicFunctionalTestc#�bK�|]'}|jd�r|tt|�f���)y�w)�test_N)r��getattr�	ac_tester)�.0r's  r�	<genexpr>zClinicFunctionalTest.<genexpr>ds1����L��$�/�/�'�2J��7�9�d�3�4�L�s�-/c�f�|jt�5tj�ddd�|j	tjdd�d�|j	tjgd�gdf�|j	tjd�d�y#1swY�}xYw)NrNrz�rNrzzwhatever class)rNN)r�	TypeErrorr��objects_converterr~r8s r�test_objects_converterz+ClinicFunctionalTest.test_objects_convertergs���
�
�
�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)NrN�BytesObject)r�)rr�r��bytes_object_converterr~r8s r�test_bytes_object_converterz0ClinicFunctionalTest.test_bytes_object_converternsO��
�
�
�y�
)�	0��,�,�Q�/�	0�����9�9�.�I�K\�]�	0�	0���A�A#c���|jt�5tjd�ddd�t	d�}|jtj|�|f�y#1swY�;xYw)NrNsByteArrayObject)rr�r��byte_array_object_converter�	bytearrayr~)r�byte_arrs  r� test_byte_array_object_converterz5ClinicFunctionalTest.test_byte_array_object_converterss[��
�
�
�y�
)�	5��1�1�!�4�	5��/�0������>�>�x�H�8�+�V�	5�	5�s�A&�&A/c���|jt�5tjd�ddd�|j	tjd�d�y#1swY�/xYw)NrNr])r])rr�r��unicode_converterr~r8s r�test_unicode_converterz+ClinicFunctionalTest.test_unicode_converterysN��
�
�
�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)TTTrC�)FFT)z	not emptyrNrzr)TTF)rr�r��bool_converterr~r8s 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)NrNsab)�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�)rr�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�rN���"�8�rrrrD�{�rrr�)�	_testcapir�r�
OverflowErrorr��unsigned_char_converterr�r~)rr�s  r�test_unsigned_char_converterz1ClinicFunctionalTest.test_unsigned_char_converter�sD��'�
�
�
�}�
-�	2��-�-�b�1�	2�
�
�
�}�
-�	=��-�-�i�!�m�<�	=�
�
�
�}�
-�	@��-�-�a��Q��?�	@�
�
�
�y�
)�	2��-�-�b�1�	2�����:�:�<�l�K�����:�:�1�a��Q��O�QZ�[�����:�:�1�a�)�a�-�ST�AT�WZ�AZ�[�]h�i�	2�	2��	=�	=��	@�	@��	2�	2��/�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_MAXrN�.����r���)r�)	r�r�r�rr�r��short_converterr�r~)rr�r�s   r�test_short_converterz)ClinicFunctionalTest.test_short_converter�s���0�
�
�
�}�
-�	4��%�%�h��l�3�	4�
�
�
�}�
-�	4��%�%�h��l�3�	4�
�
�
�y�
)�	*��%�%�b�)�	*�����2�2�5�9�8�D�����2�2�4�8�'�B�	4�	4��	4�	4��	*�	*�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�rNr�r�rDr�r�)	r�r�rr�r��unsigned_short_converterr�r�r~)rr�s  r�test_unsigned_short_converterz2ClinicFunctionalTest.test_unsigned_short_converter�sD��'�
�
�
�z�
*�	3��.�.�r�2�	3�
�
�
�}�
-�	>��.�.�y�1�}�=�	>�
�
�
�}�
-�	A��.�.�q�)�a�-�@�	A�
�
�
�y�
)�	3��.�.�r�2�	3�����;�;�=�|�L�����;�;�A�q�)�a�-�P�R[�\�����;�;�A�q�9�q�=�TU�BU�X[�B[�\�^i�j�	3�	3��	>�	>��	A�	A��	3�	3�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_MAXrNrzrD)r�r��-�3)
r�r�r�rr�r�r3r�r~r�)rr�r�s   r�test_int_converterz'ClinicFunctionalTest.test_int_converter�s��.�
�
�
�}�
-�	1��#�#�G�a�K�0�	1�
�
�
�}�
-�	1��#�#�G�a�K�0�	1�
�
�
�y�
)�	-��#�#�A�q�!�,�	-�
�
�
�y�
)�	(��#�#�B�'�	(�����0�0�2�L�A�����0�0��A�s�;�a��C��H�=M�N�	1�	1��	1�	1��	-�	-��	(�	(�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�rNr�r�rDr�r�)	r�r�rr�r��unsigned_int_converterr�r�r~)rr�s  r�test_unsigned_int_converterz0ClinicFunctionalTest.test_unsigned_int_converter�s?��&�
�
�
�z�
*�	1��,�,�R�0�	1�
�
�
�}�
-�	;��,�,�X��\�:�	;�
�
�
�}�
-�	>��,�,�Q��1��=�	>�
�
�
�y�
)�	1��,�,�R�0�	1�����9�9�;�\�J�����9�9�!�Q��1��M�y�Y�����9�9�!�Q��A��QR�@R�UX�@X�Y�[f�g�	1�	1��	;�	;��	>�	>��	1�	1�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_MAXrN�r�r�r�)	r�r�r�rr�r��long_converterr�r~)rr�r�s   r�test_long_converterz(ClinicFunctionalTest.test_long_converter�s���0�
�
�
�}�
-�	3��$�$�X��\�2�	3�
�
�
�}�
-�	3��$�$�X��\�2�	3�
�
�
�y�
)�	)��$�$�R�(�	)�����1�1�3�U�;�����1�1�%�8�(�C�	3�	3��	3�	3��	)�	)��#�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�rNr�r�rDr�r�)	r�r�rr�r��unsigned_long_converterr�r�r~)rr�s  r�test_unsigned_long_converterz1ClinicFunctionalTest.test_unsigned_long_converter�sD��'�
�
�
�z�
*�	2��-�-�b�1�	2�
�
�
�}�
-�	=��-�-�i�!�m�<�	=�
�
�
�}�
-�	@��-�-�a��Q��?�	@�
�
�
�y�
)�	2��-�-�b�1�	2�����:�:�<�l�K�����:�:�1�a��Q��O�QZ�[�����:�:�1�a�)�a�-�ST�AT�WZ�AZ�[�]h�i�	2�	2��	=�	=��	@�	@��	2�	2�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_MAXrNr�r�r�)	r�r�r�rr�r��long_long_converterr�r~)rr�r�s   r�test_long_long_converterz-ClinicFunctionalTest.test_long_long_converter�s���2�
�
�
�}�
-�	9��)�)�)�a�-�8�	9�
�
�
�}�
-�	9��)�)�)�a�-�8�	9�
�
�
�y�
)�	.��)�)�"�-�	.�����6�6�8�%�@�����6�6�u�=�x�H�	9�	9��	9�	9��	.�	.�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�rNr�r�rDr�r�)	r�r�rr�r��unsigned_long_long_converterr�r�r~)rr�s  r�!test_unsigned_long_long_converterz6ClinicFunctionalTest.test_unsigned_long_long_converter�sJ��(�
�
�
�z�
*�	7��2�2�2�6�	7�
�
�
�}�
-�	C��2�2�:��>�B�	C�
�
�
�}�
-�	F��2�2�1�j�1�n�E�	F�
�
�
�y�
)�	7��2�2�2�6�	7�����?�?�A�<�P�����?�?��1�j�ST�n�U�W`�a�����?�?��1�z�TU�~�YZ�FZ�]`�F`�a�cn�o�	7�	7��	C�	C��	F�	F��	7�	7�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_MAXrNr�rz�rNrzr�)	r�r�r�rr�r��py_ssize_t_converterr�r~�rr�r�s   r�test_py_ssize_t_converterz.ClinicFunctionalTest.test_py_ssize_t_converters���<�
�
�
�}�
-�	?��*�*�>�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)Nrr�r�rNrzr�i�)r�r�r�rr�r��slice_index_converterr~r�s   r�test_slice_index_converterz/ClinicFunctionalTest.test_slice_index_converters���<�
�
�
�y�
)�	0��+�+�B�/�	0�����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�
	0�	0�s�C(�(C1c�H�|jt�5tjd�ddd�|jt�5tjg�ddd�|jtj�d�y#1swY�axYw#1swY�:xYw)Nr�r�)rr�r��size_t_converterr�r~r8s r�test_size_t_converterz*ClinicFunctionalTest.test_size_t_converters}��
�
�
�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	)rr�r��float_converterr~r8s r�test_float_converterz)ClinicFunctionalTest.test_float_converter"sg��
�
�
�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)rr�r��double_converterr~r8s r�test_double_converterz*ClinicFunctionalTest.test_double_converter(sg��
�
�
�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)NrNrzz-1-2jr	r
�
)r)rr�r��py_complex_converterr~�complexr8s r�test_py_complex_converterz.ClinicFunctionalTest.test_py_complex_converter.s���
�
�
�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)NrNr�r�r��bbr�r�r��cc�r�r�r)rr�r�rFr�r~r8s r�test_str_converterz'ClinicFunctionalTest.test_str_converter6s���
�
�
�y�
)�	'��#�#�A�&�	'�
�
�
�y�
)�	3��#�#�C��c�2�	3�
�
�
�z�
*�	7��#�#�C��#�6�	7�����0�0��d�C�@�/�R�����0�0��d�D�A�?�S�����0�0��d�F�C�EW�X�	'�	'��	3�	3��	7�	7�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)NrNr�r�r�r�rr�rrscc)rr�r��str_converter_encodingr~r�r�r8s r�test_str_converter_encodingz0ClinicFunctionalTest.test_str_converter_encodingAs��
�
�
�y�
)�	0��,�,�Q�/�	0�����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�	0�	0��	@�	@�s�D7�0E�7E�E
c	���|jt�5tjdd�ddd�|j	tjdtgd���d�y#1swY�;xYw)Nr�r��abc�rNrzrD)sabcs)rr�r��py_buffer_converterr~r�r8s r�test_py_buffer_converterz-ClinicFunctionalTest.test_py_buffer_converterLsX��
�
�
�y�
)�	4��)�)�#�s�3�	4�����6�6�u�i�	�>R�S�Un�o�	4�	4�s�A'�'A0c���|jtjdd�d�|jtjdd��d�|jtjdd��d�y)NrNrzr��r�r�)r~r��keywordsr8s r�
test_keywordsz"ClinicFunctionalTest.test_keywordsQsY������+�+�A�q�1�6�:�����+�+�A��3�V�<�����+�+�a�1�5�v�>rc� �|jt�5tjdd�ddd�|j	tjdd��d�|j	tjdd��d�y#1swY�XxYw)NrNrzr$r�r�)rr�r��keywords_kwonlyr~r8s r�test_keywords_kwonlyz)ClinicFunctionalTest.test_keywords_kwonlyVso��
�
�
�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)NrN�rNNNrz�rNrzNrDr r$�r��r�r��rNNrDr�)r~r��keywords_optr8s 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)NrN�rNNNNrz�rNrzNNrDr$r-�rNrzrDNr.)rNNrDN��r�r�r�r]�rNrzrDr6)r~r��keywords_opt_kwonlyrr�r8s r�test_keywords_opt_kwonlyz-ClinicFunctionalTest.test_keywords_opt_kwonlyes�������6�6�q�9�;P�Q�����6�6�q�!�<�>P�Q�
�
�
�y�
)�	3��)�)�!�Q��2�	3�����6�6�q�A�>�@R�S�����6�6�q�!�q�A�?�S�����6�6��a�@�BT�U�����6�6��a�1��J�L�Y�	3�	3�s�!D!�!D*c��|jtjd�d�|jt�5tjdd�ddd�|jtjdd��d�|jtjdd��d�|jtjddd�	�d
�y#1swY��xYw)NrNr+rzr$r,rDr.r/r�r )r~r��keywords_kwonly_optrr�r8s r�test_keywords_kwonly_optz-ClinicFunctionalTest.test_keywords_kwonly_optos�������6�6�q�9�?�K�
�
�
�y�
)�	0��)�)�!�Q�/�	0�����6�6�q�A�>��M�����6�6��a�@�,�O�����6�6��a�1�E�y�Q�		0�	0�s�C�Cc��|jt�5tjd�ddd�|jt�5tjdd��ddd�|j	tjdd�d�|j	tjdd��d�y#1swY��xYw#1swY�cxYw)NrNrzr�r�r$)rr�r��posonly_keywordsr~r8s r�test_posonly_keywordsz*ClinicFunctionalTest.test_posonly_keywordsws���
�
�
�y�
)�	*��&�&�q�)�	*�
�
�
�y�
)�	1��&�&��a�0�	1�����3�3�A�q�9�6�B�����3�3�A��;�V�D�	*�	*��	1�	1�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)NrNrzr�r$r�)rr�r��posonly_kwonlyr~r8s r�test_posonly_kwonlyz(ClinicFunctionalTest.test_posonly_kwonlys���
�
�
�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)NrNrzrDr�r-r �r�r�)rr�r��posonly_keywords_kwonlyr~r8s r�test_posonly_keywords_kwonlyz1ClinicFunctionalTest.test_posonly_keywords_kwonly�s���
�
�
�y�
)�	1��-�-�a�0�	1�
�
�
�y�
)�	7��-�-�a��A�6�	7�
�
�
�y�
)�	=��-�-��Q�!�<�	=�����:�:�1�a�1�E�y�Q�����:�:�1��Q�G��S�	1�	1��	7�	7��	=�	=�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)NrNrzr4rDr5r6r8r$r-r7�r�r�r])rr�r��posonly_keywords_optr~r8s 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)
NrNr3rzr4rDr5r6r8r$r-�r�r]r7)r~r��posonly_opt_keywords_optrr�r8s r�test_posonly_opt_keywords_optz2ClinicFunctionalTest.test_posonly_opt_keywords_opt�s0������;�;�A�>�@U�V�����;�;�A�q�A�CU�V�����;�;�A�q�!�D�o�V�����;�;�A�q�!�Q�G��V�
�
�
�y�
)�	7��.�.�q�A�6�	7�����;�;�A�q�A�F��X�����;�;�A�q�A��K�\�Z�
�
�
�y�
)�	C��.�.��a�1��B�	C�	C�		7�	7��	C�	C�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)NrNrzr$r4rDrEr5r6rIr8r7)rr�r��posonly_kwonly_optr~r8s 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)NrNr3rzr4rDr$r-r5r6rMr8)r~r��posonly_opt_kwonly_optrr�r8s r�test_posonly_opt_kwonly_optz0ClinicFunctionalTest.test_posonly_opt_kwonly_opt�s�������9�9�!�<�>S�T�����9�9�!�Q�?�AS�T�
�
�
�y�
)�	6��,�,�Q��1�5�	6�
�
�
�y�
)�	5��,�,�Q�!�4�	5�����9�9�!�Q�!�D�o�V�����9�9�!�Q�!�q�I�<�X�	6�	6��	5�	5�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)NrNrzr$rDr�r-�rNrzrDNNrEr6rM�rNrzrDr6Nr��r�r]�e�rNrzrDr6r�)rr�r��posonly_keywords_kwonly_optr~r8s r� test_posonly_keywords_kwonly_optz5ClinicFunctionalTest.test_posonly_keywords_kwonly_opt�s���
�
�
�y�
)�	5��1�1�!�4�	5�
�
�
�y�
)�	8��1�1�!�Q�7�	8�
�
�
�y�
)�	:��1�1�!�q�9�	:�
�
�
�y�
)�	;��1�1�!�Q��:�	;�
�
�
�y�
)�	A��1�1�A��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�	5�	5��	8�	8��	:�	:��	;�	;��	A�	A�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)NrNrz)rNrzNNNr$rDr6r�r-rWrE�r]rXrMr��r]rZr[rY)rr�r��posonly_keywords_opt_kwonly_optr~r8s r�$test_posonly_keywords_opt_kwonly_optz9ClinicFunctionalTest.test_posonly_keywords_opt_kwonly_opt�s���
�
�
�y�
)�	9��5�5�a�8�	9�����B�B�1�a�H�Jb�c�����B�B�1��J�Ld�e�
�
�
�y�
)�	B��5�5�a��A�q�A�	B�
�
�
�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�	9�	9��	B�	B��	@�	@�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)
NrNr3rzr4r$rDr5r-r6r_r8rM)r~r��#posonly_opt_keywords_opt_kwonly_optrr�r8s r�(test_posonly_opt_keywords_opt_kwonly_optz=ClinicFunctionalTest.test_posonly_opt_keywords_opt_kwonly_opt�s:������F�F�q�I�K`�a�����F�F�q�!�L�N`�a�
�
�
�y�
)�	B��9�9�!�q�A�	B�����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�
)�	F��9�9�!�Q��1�E�	F�	F�
	B�	B��	F�	F�s�!E�7E%�E"�%E.c�J�|jt�5tj�ddd�|jt�5tjd�ddd�|j	tjd��d�y#1swY�cxYw#1swY�<xYw)NrNr��rN)rr�r��keyword_only_parameterr~r8s r�test_keyword_only_parameterz0ClinicFunctionalTest.test_keyword_only_parameter�s}��
�
�
�y�
)�	/��,�,�.�	/�
�
�
�y�
)�	0��,�,�Q�/�	0�����9�9�A�>��E�		/�	/��	0�	0�s�B
�B�
B�B"c�j�|jt�5tj�ddd�|j	tjdd�d�|j	tjdd��d�|j	tjdddd�d�y#1swY�xYw)NrNrz)rNrzr#r$rDr6)rNrz)rDr6)rr�r��posonly_varargr~r8s r�test_posonly_varargz(ClinicFunctionalTest.test_posonly_vararg�s���
�
�
�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�NrNrzr$rDr6)rN�rzrDr6)rr�r��vararg_and_posonlyr~r8s r�test_vararg_and_posonlyz,ClinicFunctionalTest.test_vararg_and_posonly�s���
�
�
�y�
)�	+��(�(�*�	+�
�
�
�y�
)�	1��(�(��a�0�	1�����5�5�a��A�q�A�>�R�		+�	+��	1�	1���B�B�B�B&c�R�|jt�5tj�ddd�|jt�5tjdd��ddd�|j	tjdddd�d�y#1swY�gxYw#1swY�>xYwrn)rr�r��varargr~r8s r�test_varargz ClinicFunctionalTest.test_varargs���
�
�
�y�
)�	�����	�
�
�
�y�
)�	%����Q�!�$�	%�����)�)�!�Q��1�5�~�F�		�	��	%�	%�rrc	�r�|jt�5tj�ddd�|j	tjdd��d�|j	tjdddd�d�|j	tjddddd	��d
�y#1swY��xYw)NrNFr$)rNr#FrzrDr6)rNroFT)rNroT)rr�r��vararg_with_defaultr~r8s r�test_vararg_with_defaultz-ClinicFunctionalTest.test_vararg_with_defaults���
�
�
�y�
)�	,��)�)�+�	,�����6�6�q�E�B�N�S�����6�6�q�!�Q��B�DY�Z�����6�6�q�!�Q��T�J�L`�a�		,�	,�s�B-�-B6c	��|jtj�d�|jtjd��d�|jtjdd��d�|jtjdddd�d	�|jtjddddd
��d�y)N)r#Nrzr$)r#rzrN)rgrzrDr6)r8Nr�)r8r�)r~r��vararg_with_only_defaultsr8s r�test_vararg_with_only_defaultsz3ClinicFunctionalTest.test_vararg_with_only_defaultss�������<�<�>�
�K�����<�<�q�A�7�K�����<�<�Q�!�D�j�Q�����<�<�Q��1�a�H�J^�_�����<�<�Q��1�a�1�M�O`�arc�:�tjdddddd��y)NrNrzrDr6r��)�kw1�kw2)r��gh_32092_oobr8s r�test_gh_32092_oobz&ClinicFunctionalTest.test_gh_32092_oobs�����q�!�Q��q�a�8rc�2�tjddd�y)NrNrzrD)r��gh_32092_kw_passr8s r�test_gh_32092_kw_passz*ClinicFunctionalTest.test_gh_32092_kw_passs���"�"�1�a��+rc��d}tj|�}tj|�tj|�}|j	||�y)Nz5*A unique string is not referenced by anywhere else.*)r_�getrefcountr��gh_99233_refcountr~)r�arg�arg_refcount_origin�arg_refcount_afters    r�test_gh_99233_refcountz+ClinicFunctionalTest.test_gh_99233_refcountsE��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_free"s<��r��
�
#�
#�I�~�
>�	7��*�*�3��6�	7�	7�	7�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'sr���
�
�
#�
#�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�rr�r~)rr'�funcs   r�1test_cloned_func_with_converter_exception_messagezFClinicFunctionalTest.test_cloned_func_with_converter_exception_message.sW��>�	/�D����4��(�
/��y�$�/��� � ����.�
/�
/�	/�
/�
/�rwc��tj�}|j}t|jt
d�}||d�||d��y)N�no argumentsrNr�)r��	TestClass�meth_method_no_paramsrr�r�)r�obj�meth�checks    r�test_meth_method_no_paramsz/ClinicFunctionalTest.test_meth_method_no_params4sB���!�!�#���(�(����.�.�	�>�J��
�d�A��
�d�a�rc��ddlm}tj�}|j}||dd�||dd�||dd�||dd�t|jtd�}|||dd�|||dd�y)Nr)�pyobject_vectorcallr#r�rgr�)r�r�r�r�r�rr�r�)rr�r�r�r�s     r�test_meth_method_no_params_capiz4ClinicFunctionalTest.test_meth_method_no_params_capi;s���1��!�!�#���(�(���D�$��-��D�"�d�+��D�"�b�)��D�$��+���.�.�	�>�J��
�!�4��t�4�
�!�4��v�6rN)<rr r!�locals�update�dirr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr"r&r)r1r:r=r@rCrGrKrOrRrUr]rbrerirlrqrurxr{r�r�r�r�r�r�r�r�r#rrr|r|bsX��
�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�b�b�9�,�B�7�
.�/��7rr|c� �eZdZ	d�Zd�Zd�Zy)�PermutationTestsc��d}ttgd���}ttj|��}|j||�y)N)r#)rD)rzrDr r )r
rfr�r�permute_left_option_groupsr~�rr��datar�s    r�test_permute_left_option_groupsz0PermutationTests.test_permute_left_option_groupsLs>��
���C�	�N�#���v�8�8��>�?�������*rc��d}ttgd���}ttj|��}|j||�y)N)r#rgr�r r )r
rfr�r�permute_right_option_groupsr~r�s    r� test_permute_right_option_groupsz1PermutationTests.test_permute_right_option_groupsWs>��
���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)Nr#)r#)�left�required�rightr�r$r-)r$rErEr_)rErIr`)rErI)r�r�r]rZr�)r$r�)rEr�r�)r-rEr�)r$r�r�rM)rZr
)rMrIr7)r�r�r�r]rZ)r�r�r�r]rZr
)r�r�rr�r�r~)r�empty�noleft1�noleft2�noleft3�noright1�noright2�noright3�
leftandright1�
leftandright2rsr�r�r�r�r��permutationsr�s                  r�test_permute_optional_groupsz-PermutationTests.test_permute_optional_groupsbsX���B���
��
�F�V��
���K�&��
���K�*��
������
���
�R��
���F�R��
������
�
��J���	
�
�
��W�g��h���=�	
���	3�F�����'��'�
3�28�-�-�/�/��h��x�%�=�=�d�H�e�T���|�,��� � ���2�	
3�
3�	3�
3�
3�s
�"A
B7�7C	N)rr r!r�r�r�r#rrr�r�Is��-�	+�	+�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�)rjr�)r�r�&strip_leading_and_trailing_blank_linesr~)rrsrjr�r�s     r�+test_strip_leading_and_trailing_blank_linesz=FormatHelperTests.test_strip_leading_and_trailing_blank_lines�sh��
�� '�	0�O�E�8����E�H��=�
0��C�C�E�J��� � ��h�/�
0�
0�	0�
0�
0���(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)rr6�)�indent)�itemsr�r�normalize_snippetr~)	r�snippet�zero_indent�four_indent�eight_indent�expected_outputsr�r�r�s	         r�test_normalize_snippetz(FormatHelperTests.test_normalize_snippet�s�����
�	�
�	�
�	�
 +�{�|�L�� 0� 6� 6� 8�	3��F�H����V��,�
3��1�1�'�&�I��� � ���2�
3�
3�	3�
3�
3�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)NrCr�r�r�r]�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))rr)z\abcz\\abc)z\a\bcz\\a\\bc)z\a\\bcz	\\a\\\\bc)z"abc"z\"abc\")z'a'z\'a\')rkr�)r�r�quoted_for_c_stringr~)rrsrkr�r�s     r�test_quoted_for_c_stringz*FormatHelperTests.test_quoted_for_c_string�sh��
��&�	0�N�D�(����4�(��;�
0��0�0��6��� � ��h�/�
0�
0�	0�
0�
0�r�c�Z�d}d}tj|�}|j||�y)Nza 
b
 c
 d 
z
a
b
 c
 d
)r�rstrip_linesr~�rrjr�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~)rrkr�r�s    r�test_format_escapez$FormatHelperTests.test_format_escape	s,���� ���"�"�4�(������h�'rc��|jtjdd��d�d}d}tj|d��}|j||�d}d}tj|d��}|j||�y)NrC�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_lines	�������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)NrC�foo)�suffixr�z
onefoo
twofoor�zfoo
onefoo
twofoo
)r~r�suffix_all_linesr�s    r�test_suffix_all_linesz'FormatHelperTests.test_suffix_all_lines7	r�rN)rr r!r�r�r�r�r�r�r�r�r#rrr�r��s*��0�&3�:+�
0�(� (�(�>(rr��__main__)0�	functoolsr�testrr�test.supportr�test.support.os_helperrr�textwrapr	�unittestr
rTrd�os.pathr&rr_�skip_if_missing�imports_under_toolrrrr%r,r5rlr�rAror�r�r�rrrr��_testclinicr��ImportError�skipIfr|r�r�r�mainr#rr�<module>r�s���
�$�"�1�������
���
���8�$�"�Z�"�"�8�,�!�� �!�

G�(�
G���0�0�Q�Q��F�M�M�3�6�2��-8�-8�`c �+�c �L-*�h�-*�`2&�X�2&�h
�
�#�#�:�H�:�zS
+�{�S
+�lB ��B �J�#������d�"�$<�=�c7�8�,�,�c7�>�c7�Lg3�x�(�(�g3�Ta(��)�)�a(�H�z���H�M�M�O��IJ!�!��X2���I��s�%F	�F�	F�F �F