
    ;e-                    d   d dl mZmZ d dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlZd dlZd dlZd dlZd dlZd dlZ ej        d            ej        d          5  d dlZd d	lmZ ddd           n# 1 swxY w Y    G d
 de          Z G d d          Z G d d          Z G d d          Z ej        dd          Z G d d          Z G d de          Z G d de          Z  G d de          Z! G d d          Z" G d d           Z# G d! d"e          Z$ G d# d$e          Z% G d% d&e          Z&	 d dl'Z(n# e)$ r dZ(Y nw xY w ej*        e(du d'           G d( d)ej                              Z+ G d* d+ej                  Z,e-d,k    r ej.                     dS dS )-    )support
test_tools)	os_helper)SHORT_TIMEOUTrequires_subprocess)TESTFNunlink)dedent)TestCaseNclinic)	DSLParserc                       e Zd ZdZd Zd ZdS )_ParserBaseNc                     t          j                    5 }|                     t                    5   ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                                S N)r   captured_stdoutassertRaises
SystemExitgetvalue)selfparser_inputstdouts       '/usr/lib/python3.11/test/test_clinic.pyexpect_parser_failurez!_ParserBase.expect_parser_failure   s    $&& 	&"":..  v              	 	 	 	 	 	 	 	 	 	 	 	 	 	 	    s3   AAAA	AA	AA"%A"c                 8    |                      | j        |          S r   )r   parse_function)r   r   s     r   parse_function_should_failz&_ParserBase.parse_function_should_fail!   s    ))$*=vFFF    )__name__
__module____qualname__maxDiffr   r    r   r   r   r      s<        G! ! !G G G G Gr   r   c                       e Zd Zd ZdS )FakeConverterc                 "    || _         || _        d S r   )nameargsr   r(   r)   s      r   __init__zFakeConverter.__init__&   s    				r   N)r    r!   r"   r+   r$   r   r   r&   r&   %   s#            r   r&   c                       e Zd Zd Zd ZdS )FakeConverterFactoryc                     || _         d S r   r(   r   r(   s     r   r+   zFakeConverterFactory.__init__,   s    			r   c                 ,    t          | j        |          S r   )r&   r(   )r   r(   defaultkwargss       r   __call__zFakeConverterFactory.__call__/   s    TY///r   N)r    r!   r"   r+   r4   r$   r   r   r-   r-   +   s2          0 0 0 0 0r   r-   c                       e Zd Zd Zd ZdS )FakeConvertersDictc                     i | _         d S r   )used_convertersr   s    r   r+   zFakeConvertersDict.__init__4   s    !r   c                 R    | j                             |t          |                    S r   )r8   
setdefaultr-   )r   r(   r2   s      r   getzFakeConvertersDict.get7   s$    #..t5I$5O5OPPPr   N)r    r!   r"   r+   r<   r$   r   r   r6   r6   3   s7        " " "Q Q Q Q Qr   r6   Cfile)languagefilenamec                   D    e Zd Zd Zd Zd Zd Zd Zej	        j
        Z
dS )
FakeClinicc                    t                      | _        t                      | _        t          j        d           | _        d | _        i | _        t          j        d| j                  | _	        t          j                    | _        t          j                    | _        | t          _        d| _        dx| _        | _        i | _        |                     dd           |                     dd           |                     dd           | j        j        }t          j        d |d          fd |d          fd	 |d          fd
 |d          fd |d          fd |d          fd |d          ff          | _        d S )N rB   blockbufferr>   suppressdocstring_prototypedocstring_definitionmethoddef_defineimpl_prototypeparser_prototypeparser_definitionimpl_definition)r6   
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     r   r+   zFakeClinic.__init__=   sx   ,..!3!5!5(..#% ".r4=AA".00".00 	.004+Wh///VX...Z444!"-"9"AAjMM2#QQwZZ07,qqzz*:/ !!G**-'

+;
 # #r   c                     | j                             |          }|s$t          j        dt	          |          z              |S )NzDestination does not exist: )r[   r<   sysexitrepr)r   r(   r^   s      r   get_destinationzFakeClinic.get_destinationX   sB    !!$'' 	BH3d4jj@AAAr   c                     || j         v r$t          j        dt          |          z              t	          j        ||| g|R  | j         |<   d S )NzDestination already exists: )r[   r`   ra   rb   r   Destination)r   r(   typer)   s       r   r\   zFakeClinic.add_destination^   sV    4$$$H3d4jj@AAA"("4T4"M"M"M"M$r   c                     |dk    S )Nmoduler$   r0   s     r   is_directivezFakeClinic.is_directivec   s    xr   c                     || j         |<   d S r   )called_directivesr*   s      r   	directivezFakeClinic.directivef   s    '+t$$$r   N)r    r!   r"   r+   rc   r\   ri   rl   r   Clinic_module_and_classr$   r   r   rB   rB   <   sk          6  N N N
     , , , 7r   rB   c                   t    e 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 Zd Zd ZdS )ClinicWholeFileTestc                 `    t          j        t          j        d           d          | _         d S )Ntest.cr@   )r   rm   rQ   r9   s    r   setUpzClinicWholeFileTest.setUpm   s'    mF$4T$:$:XNNNr   c                     t          |                                          }|                     | j        j        |          S r   )r
   stripr   r   parse)r   rawr   s      r   expect_failurez"ClinicWholeFileTest.expect_failurep   s4    ""$$))$+*;VDDDr   c                     d}| j                             |                                          }|d                                         }|                     |d           |                     |d           d S )Nz/*[clinic]
foo
[clinic]*/   z[clinic]*/[clinic]*/z
[clinic]*/)r   rw   
splitlinesrstripassertNotEqualassertEqual)r   rx   cookedend_lines       r   test_eolzClinicWholeFileTest.test_eolt   st     ,""3''2244!9##%% 	H&<===<00000r   c                 d    d}d}|                      |          }|                     ||           d S )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]*/'
ry   r   r   rx   msgouts       r   test_mangled_marker_linez,ClinicWholeFileTest.test_mangled_marker_line   sE    \ 	 !!#&&c"""""r   c                 d    d}d}|                      |          }|                     ||           d S )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
ry   assertInr   s       r   test_checksum_mismatchz*ClinicWholeFileTest.test_checksum_mismatch   sB    + 	 !!#&&c3r   c                 d    d}d}|                      |          }|                     ||           d S )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   sD    
9 	 !!#&&c"""""r   c                 d    d}d}|                      |          }|                     ||           d S )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   sE    
c 	 !!#&&c"""""r   c                 ^   t          j        d           }d|_        d|_        d|_        t          j        |d          }t          d                                          }|                    |          }t          d          	                                }| 
                    ||           d S )Nz//z//[{dsl_name} start]z//[{dsl_name} stop]rr   rs   z\
            //[clinic start]
            //module test
            //[clinic stop]
        z
            //[clinic start]
            //module test
            //
            //[clinic stop]
            /*[clinic end generated code: output=da39a3ee5e6b4b0d input=65fab8adff58cf08]*/
        )r   rQ   body_prefix
start_line	stop_linerm   r
   rv   rw   lstripr   )r   clangclrx   r   expecteds         r   test_parse_with_body_prefixz/ClinicWholeFileTest.test_parse_with_body_prefix   s     && 1/]58444    UWW	 	
 hhsmm    VXX 	 	h'''''r   c                 d    d}d}|                      |          }|                     ||           d S )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   sD    & 	 !!#&&c"""""r   c                 d    d}d}|                      |          }|                     ||           d S )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   sD    : 	 !!#&&c"""""r   c                 d    d}d}|                      |          }|                     ||           d S )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   sE    P 	 !!#&&c"""""r   c                 d    d}d}|                      |          }|                     ||           d S )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   sB    ? 	 !!#&&c"""""r   c                 `    |                      d          }d}|                     ||           d S )Nzy
            /*[clinic input]
            output preset nosuchpreset
            [clinic start generated code]*/
        zUnknown preset 'nosuchpreset'r   r   r   r   s      r   $test_directive_output_unknown_presetz8ClinicWholeFileTest.test_directive_output_unknown_preset   s=    !! #  
 .c3r   c                 `    |                      d          }d}|                     ||           d S )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_pop  s=    !! #  
 3c3r   c                    t          d          }| j                            |          }|                     |                    t          d                               h d}|D ]F}|                     |          5  |                     ||           d d d            n# 1 swxY w Y   G|                                                    d          d         }|                     |                    d                     d S )Nz~
            /*[clinic input]
            output print 'I told you once.'
            [clinic start generated code]*/
        >
   cpp_if	cpp_endifrK   rN   rJ   methoddef_ifndefrL   rM   rH   rI   )field
z%/*[clinic end generated code: output=)	r
   r   rw   
assertTrue
startswithsubTestr   r}   split)r   rx   r   fieldsr   	last_lines         r   test_directive_output_printz/ClinicWholeFileTest.test_directive_output_print  sX      
 k$$ 	v / ( (   	 	 	

 
 
  	* 	*EE** * *eS)))* * * * * * * * * * * * * * *JJLL&&t,,R0	  !HII	
 	
 	
 	
 	
s   =B  B$	'B$	c                 `    |                      d          }d}|                     ||           d S )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_command4  s=    !! #  
 <c3r   c                 `    |                      d          }d}|                     ||           d S )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=  sC    !! #  K 	 	c3r   N)r    r!   r"   rt   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$   r   r   rp   rp   l   s       O O OE E E1 1 1"# # #     
# 
# 
#
# 
# 
#( ( (*# # ## # ## # ## # #          !
 !
 !
F              r   rp   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )ClinicGroupPermuterTestc                 ^    t          j        |||          }|                     ||           d S r   )r   permute_optional_groupsr   )r   lmroutputcomputeds         r   _testzClinicGroupPermuterTest._testS  s2    1!Q::*****r   c                 @    |                      dggdgdggd           d S )Nstartstopstep))r   )r   r   )r   r   r   r   r9   s    r   
test_rangez"ClinicGroupPermuterTest.test_rangeW  s7    

WI;F8*	 	 	 	 	r   c                 B    |                      ddggdgdggd           d S )Nxychattr))r   )r   r   )r   r   r   )r   r   r   r   r   r9   s    r   test_add_windowz'ClinicGroupPermuterTest.test_add_window_  s9    

S#J<$6(	 	 	 	 	r   c                 P    |                      g dddggdgddgg dgd           d S )	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   r9   s    r   test_ludicrousz&ClinicGroupPermuterTest.test_ludicroush  sO    

&&&t5vtN`N`N`?a	 	 	 	 	r   c                 B    |                      g g dgdgdggd           d S )Nabc)r$   r   r   r   r   r   r   r   r9   s    r   test_right_onlyz'ClinicGroupPermuterTest.test_right_onlys  s:    

2rSE3%.	 	 	 	 	r   c                 B    d }|                      t          |           d S )Nc                  4    t          j        dgg g            d S )Nr   )r   r   r$   r   r   fnzPClinicGroupPermuterTest.test_have_left_options_but_required_is_empty.<locals>.fn}  s    *C5"b99999r   )r   AssertionError)r   r   s     r   ,test_have_left_options_but_required_is_emptyzDClinicGroupPermuterTest.test_have_left_options_but_required_is_empty|  s-    	: 	: 	:."-----r   N)	r    r!   r"   r   r   r   r   r   r   r$   r   r   r   r   R  sn        + + +    	 	 	  . . . . .r   r   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	ClinicLinearFormatTestc                 V    t          j        |fi |}|                     ||           d S r   )r   linear_formatr   )r   inputr   r3   r   s        r   r   zClinicLinearFormatTest._test  s6    '8888*****r   c                 2    |                      dd           d S )NrD   r   r9   s    r   test_empty_stringsz)ClinicLinearFormatTest.test_empty_strings  s    

2rr   c                 2    |                      dd           d S )Nr   r   r9   s    r   test_solo_newlinez(ClinicLinearFormatTest.test_solo_newline  s    

4r   c                 2    |                      dd           d S )Nz
          abc
        r   r9   s    r   test_no_substitutionz+ClinicLinearFormatTest.test_no_substitution  s,    

 	 	 	 	 	r   c                 6    |                      ddd           d S )N6
          abc
          {name}
          def
        z%
          abc
          def
        rD   r/   r   r9   s    r   test_empty_substitutionz.ClinicLinearFormatTest.test_empty_substitution  s6    

   	 	 	 	 	 	r   c                 6    |                      ddd           d S )Nr   z6
          abc
          GARGLE
          def
        GARGLEr/   r   r9   s    r   test_single_line_substitutionz4ClinicLinearFormatTest.test_single_line_substitution  s6    

   	 	 	 	 	 	r   c                 6    |                      ddd           d S )Nr   zH
          abc
          bingle
          bungle

          def
        zbingle
bungle
r/   r   r9   s    r   test_multiline_substitutionz2ClinicLinearFormatTest.test_multiline_substitution  s6    

  % 	 
	& 
	& 
	& 
	& 
	&r   N)
r    r!   r"   r   r   r   r   r   r   r   r$   r   r   r   r     s}        + + +        	 	 	& & & & &r   r   c                       e Zd Zd Zd ZdS )InertParserc                     d S r   r$   r   r   s     r   r+   zInertParser.__init__      r   c                     d S r   r$   r   rE   s     r   rw   zInertParser.parse  r   r   Nr    r!   r"   r+   rw   r$   r   r   r   r     s2              r   r   c                       e Zd Zd Zd ZdS )
CopyParserc                     d S r   r$   r   s     r   r+   zCopyParser.__init__  r   r   c                     |j         |_        d S r   )r   r   r  s     r   rw   zCopyParser.parse  s    {r   Nr  r$   r   r   r  r    s2          # # # # #r   r  c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )ClinicBlockParserTestc                     t          j        d           }t          t          j        ||                    }t          j        |          }|D ]}|                    |           |j                                        }d S r   )r   rQ   listrS   BlockPrinterprint_blockfr   )r   r   r   r?   blockswriterrE   s          r   r   zClinicBlockParserTest._test  sy    #D))f(99::$X.. 	& 	&Eu%%%%""$$r   c                 .    |                      ||          S r   r   )r   r   s     r   
round_tripz ClinicBlockParserTest.round_trip  s    zz%'''r   c                 0    |                      d           d S )Nz@
            verbatim text here
            lah dee dah
        r  r9   s    r   test_round_trip_1z'ClinicBlockParserTest.test_round_trip_1  s'      	 	 	 	 	r   c                 0    |                      d           d S )Nz
    verbatim text here
    lah dee dah
/*[inert]
abc
[inert]*/
def
/*[inert checksum: 7b18d017f89f61cf17d47f92749ea6930a3f1deb]*/
xyz
r  r9   s    r   test_round_trip_2z'ClinicBlockParserTest.test_round_trip_2  s'     	 		 		 		 		 		r   c                    t          j        d           }t          j        |d          }t          |          |j        d<   t          |          |j        d<   |                    |          }|                     ||           d S )Nr>   rs   inertcopy)r   rQ   rm   r   parsersr  rw   r   )r   r   r   r?   r   r   s         r   _test_clinicz"ClinicBlockParserTest._test_clinic  su    #D))M(V444(^^	'&qMM	&775>>*****r   c                 2    |                      dd           d S )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  r9   s    r   test_clinic_1z#ClinicBlockParserTest.test_clinic_1  s.     			 	 	 	 	r   N)	r    r!   r"   r   r  r  r  r  r  r$   r   r   r	  r	    sq        k k k( ( (  

 
 
+ + +    r   r	  c                   Z   e 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 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 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 Z7d;d8Z8d9 Z9d:S )<ClinicParserTestc                     |                      t          |d                     |                     |j                                        t          |                                                     d S )N	docstring)r   hasattrr   r"  rv   r
   )r   r   r   s      r   checkDocstringzClinicParserTest.checkDocstring  sg    K00111++--))//11	3 	3 	3 	3 	3r   c                    t          t                                }t          j        d          }|                    |           |j        \  }}|                     d|j                   |                     d|j                   d S )Nz5
            module os
            os.access
        accessos)r   rB   r   Blockrw   
signaturesr   r(   )r   r   rE   rh   functions        r   test_trivialzClinicParserTest.test_trivial  s    :<<((    	U +8=111v{+++++r   c                     |                      t          d                    }|j        \  }}|                     d|j                   |                     d|j                   d S )NzC
            #
            module os
            os.access
        r&  r'  )rw   r
   r)  r   r(   )r   rE   rh   r*  s       r   test_ignore_linez!ClinicParserTest.test_ignore_line  sk    

6 #    
 !+8=111v{+++++r   c                 P   |                      d          }|                     d|j                   |                     dt          |j                             |j        d         }|                     d|j                   |                     |j        t          j                   d S )NzO
            module os
            os.access
                path: int
        r&  r{   path)	r   r   r(   len
parametersassertIsInstance	converterr   int_converterr   r*  ps      r   
test_paramzClinicParserTest.test_param  s    && (  
 	8=111C 344555'(((ak6+?@@@@@r   c                     |                      d          }|j        d         }|                     d|j                   d S )Nzb
            module os
            os.access
                follow_symlinks: bool = True
        follow_symlinksTr   r1  r   r2   r5  s      r   test_param_defaultz#ClinicParserTest.test_param_default)  sJ    && (  
  12qy)))))r   c                     |                      d          }|j        d         }|                     d|j                   d S )Nz
            module os
            os.access
                follow_symlinks: \
                bool \
                = \
                True
        r9  Tr:  r5  s      r   test_param_with_continuationsz.ClinicParserTest.test_param_with_continuations2  sJ    && (    12qy)))))r   c                 .   |                      d          }|j        d         }|                     t          j        |j                   |                     d|j        j                   d}|                     d          }|                     ||           d S )Nz
            module os
            os.access
                follow_symlinks: int(c_default='MAXSIZE') = sys.maxsize
            r9  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   r1  r   r`   maxsizer2   r3  	c_defaultr   )r   r*  r6  expected_msgr   s        r   test_param_default_expressionz.ClinicParserTest.test_param_default_expression>  s    && (  
  12ai000AK$9:::4 	
 -- /  
 	l+++++r   c                     |                      d          }|j        d         }|                     dt          |j                             |j        d         j        }|                     |t          j                   d S )Nz
            module os
            os.access
                follow_symlinks: bool = True
                something_else: str = ''
        r9     something_else)r   r1  r   r0  r3  r2  r   str_converter)r   r*  r6  convs       r   test_param_no_docstringz(ClinicParserTest.test_param_no_docstringT  s}    && (    12C 344555"#34>dF$899999r   c                 `    d}|                      d          }|                     ||           d S )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   rB  r   s      r   *test_param_default_parameters_out_of_orderz;ClinicParserTest.test_param_default_parameters_out_of_order`  sF    2 	
 -- /' ( (
 	l+++++r   c                     |                      d          }|j        d         }|                     d|j        j        d                    d S )Nz^
            module os
            os.access
                path: path_t(allow_fd=1)
        r/     allow_fd)r   r1  r   r3  r)   r5  s      r   !disabled_test_converter_argumentsz2ClinicParserTest.disabled_test_converter_argumentsm  sQ    && (  
 'AK,Z899999r   c                 \    |                      d          }|                     |d           d S )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   r*  s     r   test_function_docstringz(ClinicParserTest.test_function_docstringv  G    && (   	H ' 	 	 	 	 	r   c                 v    |                      t          d                    }|                     |d           d S )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$  rT  s     r   %test_explicit_parameters_in_docstringz6ClinicParserTest.test_explicit_parameters_in_docstring  sS    &&v 
/ 
( 
( 
 
 	H 
' 
	 
	 
	 
	 
	r   c                 v    |                      t          d                    }|                     |d           d S )Nzt
            module os
            os.stat
                path: str
            This/used to break Clinic!
        zc
            stat($module, /, path)
            --

            This/used to break Clinic!
        rX  rT  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  sS    &&v / ( (   	H ' 	 	 	 	 	r   c                 f    |                      d          }|                     d|j                   d S )NzA
            module os
            os.stat as os_stat_fn
        
os_stat_fn)r   r   
c_basenamerT  s     r   test_c_namezClinicParserTest.test_c_name  s=    && (   	x':;;;;;r   c                 z    |                      d          }|                     |j        t          j                   d S )Nz:
            module os
            os.stat -> int
        )r   r2  return_converterr   int_return_converterrT  s     r   test_return_converterz&ClinicParserTest.test_return_converter  s@    && (   	h79TUUUUUr   c                     |                      d          }|j        d         }|                     t          j        j        |j                   |                     d|j                   d S )Nzt
            module os
            os.access
                *
                follow_symlinks: bool = True
        r9  r   )r   r1  r   inspect	ParameterKEYWORD_ONLYkindgroupr5  s      r   	test_starzClinicParserTest.test_star  sh    && (    12*7@@@AG$$$$$r   c                     |                      d          }|j        d         }|                     d|j                   d S )Nz
            module window
            window.border
                [
                ls: int
                ]
                /
        lsrO  )r   r1  r   ri  r5  s      r   
test_groupzClinicParserTest.test_group  sI    && (   %AG$$$$$r   c                 r   |                      d          }d}|D ]\  }}|                     ||          5  |j        |         }|                     |j        |           |                     |j        t          j        j                   d d d            n# 1 swxY w Y   | 	                    |d           d S )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   rO  r(   ri  a  
            addch([y, x,] ch, [attr])


              y
                Y-coordinate.
              x
                X-coordinate.
              ch
                Character to add.
              attr
                Attributes for the character.
        
r   r   r1  r   ri  rh  re  rf  POSITIONAL_ONLYr$  r   r*  datasetr(   ri  r6  s         r   test_left_groupz ClinicParserTest.test_left_group  s%   && (  "

 # 	L 	LKD%4u55 L L'-  %000  ):)JKKKL L L L L L L L L L L L L L L 	H ' 	 	 	 	 	   ABB	B	c                 r   |                      d          }d}|D ]\  }}|                     ||          5  |j        |         }|                     |j        |           |                     |j        t          j        j                   d d d            n# 1 swxY w Y   | 	                    |d           d S )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)y2ry  )x1r   )x2r   ro  )attr1rO  )attr2rO  )attr3rO  )attr4r{   )attr5r{   )attr6r{   rp  a  
            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.
        rq  rs  s         r   test_nested_groupsz#ClinicParserTest.test_nested_groups  s&   && "( " "F
 # 	L 	LKD%4u55 L L'-  %000  ):)JKKKL L L L L L L L L L L L L L L
 	H ' 	 	 	 	 	rv  c                    t          j                    5 }|                     t                    5  |                     |           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                                S r   )r   r   r   r   r   r   )r   sr   s      r   r   z+ClinicParserTest.parse_function_should_failM  s    $&& 	'&"":.. ' '##A&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' '	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'    s4   A(AA(A	A(A	A((A,/A,c                 `    d}|                      d          }|                     ||           d S )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
        rK  rL  s      r   0test_disallowed_grouping__two_top_groups_on_leftzAClinicParserTest.test_disallowed_grouping__two_top_groups_on_leftS  sF    6 	
 -- 
/ 
 
 	l+++++r   c                 `    |                      d          }d}|                     ||           d S )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_rightf  B    -- 
/ 
 
4 	 	c3r   c                 `    |                      d          }d}|                     ||           d S )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_rightx  r  r   c                 `    |                      d          }d}|                     ||           d S )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  r   c                 `    |                      d          }d}|                     ||           d S )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  B    -- 	/ 	 	> 	 	c3r   c                 `    |                      d          }d}|                     ||           d S )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  r   c                 `    |                      d          }d}|                     ||           d S )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c3r   c                     |                      d          }|                     d|j                   |                     dt          |j                             d S )NzL
            module foo
            foo.bar

            Docstring

        zbar($module, /)
--

DocstringrO  r   r   r"  r0  r1  rT  s     r   test_no_parametersz#ClinicParserTest.test_no_parameters  s_    && (   	;X=OPPPC 34455555r   c                     |                      ddd          }|                     d|j                   |                     dt          |j                             d S )Nz
            module foo
            class foo.Bar "unused" "notneeded"
            foo.Bar.__init__

            Docstring

        rE  r{   )signatures_in_blockfunction_indexzBar()
--

DocstringrO  r  rT  s     r   test_init_with_no_parametersz-ClinicParserTest.test_init_with_no_parameters  sk    && ( "#1 ' 6 6 	183EFFFC 34455555r   c                 `    |                      d          }d}|                     ||           d S )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c3r   c                 `    |                      d          }d}|                     ||           d S )NzM
            module foo
            foo.bar as 935
                /
        zIllegal C basename: 935r  r   s      r   test_illegal_c_basenamez(ClinicParserTest.test_illegal_c_basename  s=    -- /  
 (c3r   c                 \    |                      d          }|                     d|           d S )NzX
            module foo
            foo.bar
                *
                *
        z%Function bar uses '*' more than once.r  r   r   s     r   test_single_starz!ClinicParserTest.test_single_star  s9    -- /   	=sCCCCCr   c                     d}d}|D ][}|                      |          5  |                     |          }|                     ||           d d d            n# 1 swxY w Y   \d S )N)zmodule 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.rE   )r   r   r   )r   rt  r   rE   r   s        r   #test_parameters_required_after_starz4ClinicParserTest.test_parameters_required_after_star  s    
 N 	( 	(EE** ( (55e<<c3'''( ( ( ( ( ( ( ( ( ( ( ( ( ( (	( 	(   ,AA	A	c                 `    |                      d          }d}|                     ||           d S )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  B    -- /  % 	 	c3r   c                 `    |                      d          }d}|                     ||           d S )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c3r   c                 `    |                      d          }d}|                     ||           d S )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%  sB    -- /  $ 	 	c3r   c                 `    |                      d          }d}|                     ||           d S )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_now5  r  r   c                 `    d}|                      d          }|                     ||           d S )Nz#Error on line 0:
Too many var args
zt
            module foo
            foo.bar
               *vararg1: object
               *vararg2: object
        rK  rL  s      r   'test_parameters_no_more_than_one_varargz8ClinicParserTest.test_parameters_no_more_than_one_varargB  sF    " 	 -- /   	l+++++r   c                 \    |                      d          }|                     |d           d S )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.
        rS  rT  s     r   test_function_not_at_column_0z.ClinicParserTest.test_function_not_at_column_0O  rV  r   c                 `    |                      d          }d}|                     ||           d S )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_tabsc  s=    -- /   >c3r   c                 \    |                      d          }|                     d|           d S )Nzc
            module foo
            foo.bar
              a: object
             b: object
        zIllegal outdentr  r  s     r   !test_indent_stack_illegal_outdentz2ClinicParserTest.test_indent_stack_illegal_outdentm  s9    -- /   	'-----r   c                     t                      }t          |          d_        fdj        d<   t	          j        d          }                    |           |                     j                   d S )NFc                  &    t           dd          S )NflagT)setattr)r   s   r   <lambda>z1ClinicParserTest.test_directive.<locals>.<lambda>z  s    0M0M r   setflag)rB   r   r  
directivesr   r(  rw   r   )r   r   rE   r   s      @r   test_directivezClinicParserTest.test_directivev  so    LL1'M'M'M'M)$Y''U$$$$$r   c                     |                      d          }|j        \  }}|j        d         j        }|                     |t
          j                   d S )Nz module os
os.access
   path: "s"r/  )rw   r)  r1  r3  r2  r   rG  )r   rE   rh   r*  rH  s        r   test_legacy_convertersz'ClinicParserTest.test_legacy_converters  sP    

?@@ +#F+6dF$899999r   c                     d}d}|D ][}|                      |          5  |                     |          }|                     ||           d d d            n# 1 swxY w Y   \d S )NRError on line 0:
Annotations must be either a name, a function call, or a string.
)zmodule 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_messagert  rE   r   s        r   5test_legacy_converters_non_string_constant_annotationzFClinicParserTest.test_legacy_converters_non_string_constant_annotation  s    Q 	!
  	@ 	@EE** @ @55e<<  &>???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @	@ 	@r  c                     d}d}|D ][}|                      |          5  |                     |          }|                     ||           d d d            n# 1 swxY w Y   \d S )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5e<<  &>???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @	@ 	@r  c                 d    d}d}|                      |          }|                     ||           d S )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 *")
        rK  r   expected_error_msgrE   r   s       r   test_self_param_placementz*ClinicParserTest.test_self_param_placement  sE    ( 	
 --e44011111r   c                 d    d}d}|                      |          }|                     ||           d S )Nz?Error on line 0:
A 'self' parameter cannot be marked optional.
zj
            module foo
            foo.func
                self: self(type="PyObject *") = None
        rK  r  s       r   "test_self_param_cannot_be_optionalz3ClinicParserTest.test_self_param_cannot_be_optional  sE    > 	
 --e44011111r   c                 d    d}d}|                      |          }|                     ||           d S )NzError 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
        rK  r  s       r   #test_defining_class_param_placementz4ClinicParserTest.test_defining_class_param_placement  sF    O 	
 --e44011111r   c                 d    d}d}|                      |          }|                     ||           d S )NzIError on line 0:
A 'defining_class' parameter cannot be marked optional.
zs
            module foo
            foo.func
                cls: defining_class(type="PyObject *") = None
        rK  r  s       r   ,test_defining_class_param_cannot_be_optionalz=ClinicParserTest.test_defining_class_param_cannot_be_optional  sF    H 	
 --e44011111r   c                     d}d}|                      t          |          5  |                     |           d d d            d S # 1 swxY w Y   d S )Nz
            module foo
            class Foo "" ""
            Foo.__init__
                cls: defining_class
                a: object
        z0Slot methods cannot access their defining class.)assertRaisesRegex
ValueErrorr   )r   rE   r   s      r   .test_slot_methods_cannot_access_defining_classz?ClinicParserTest.test_slot_methods_cannot_access_defining_class  s     A##J44 	' 	'&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	's   AA
Ac                 `    d}|                      d          }|                     ||           d S )Nz1Error on line 0:
__new__ must be a class method!
zT
            module foo
            class Foo "" ""
            Foo.__new__
        rK  r   r  r   s      r   test_new_must_be_a_class_methodz0ClinicParserTest.test_new_must_be_a_class_method  sG    0 	 -- /  
 	011111r   c                 `    d}|                      d          }|                     ||           d S )NzQError on line 0:
__init__ must be a normal method, not a class or static method!
zn
            module foo
            class Foo "" ""
            @classmethod
            Foo.__init__
        rK  r  s      r   !test_init_must_be_a_normal_methodz2ClinicParserTest.test_init_must_be_a_normal_method  sH    P 	 -- /   	011111r   c                     t                      }t          |          }t          j        |          }|                    |           |S r   )rB   r   r   r(  rw   )r   textr   r   rE   s        r   rw   zClinicParserTest.parse  s<    LL1T""Ur   r{   rO  c                     |                      |          }|j        }|                     t          |          |           ||         S r   )rw   r)  r   r0  )r   r  r  r  rE   r  s         r   r   zClinicParserTest.parse_function	  sE    

4  Q!4555   r   c                    |                      t          t          j                  d           |                      t          t          j                  d           d}t          j                    5 }|                     t                    5  t          j	        ddd           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |
                                }|                      ||           d S )Nz<Unspecified>z<Null>z>Error in file "clown.txt" on line 69:
The igloos are melting!
zThe igloos are melting!z	clown.txtE   )r@   line_number)r   rb   r   unspecifiedNULLr   r   r   r   failr   )r   r   r   actuals       r   test_scaffoldingz!ClinicParserTest.test_scaffolding  s   f011?CCCfk**H555( 	 $&& 	B&"":.. B B5%0bB B B BB B B B B B B B B B B B B B B	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B ""*****s6   0CB/#C/B3	3C6B3	7CC
C
N)r{   rO  ):r    r!   r"   r$  r+  r-  r7  r;  r=  rC  rI  rM  rQ  rU  rY  r[  r_  rc  rj  rm  ru  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  rw   r   r  r$   r   r   r   r     sf       3 3 3
	, 	, 	,, , ,
A 
A 
A* * *
* 
* 
*, , ,,
: 
: 
:, , ,: : :  (  0  < < <V V V	% 	% 	%
% 
% 
%( ( (TL L L\! ! !, , ,&     $     $     $     "     "
  
  
 	6 	6 	66 6 6          D D D( ( (     
  
  
            , , ,  (     . . .% % %: : :@ @ @ @ @ @2 2 22 2 22 2 2 2 2 2
' 
' 
'
2 
2 
22 2 2  ! ! ! !+ + + + +r   r   c                       e Zd ZdZej                            ej        dd          Z	dd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S )ClinicExternalTestNr   z	clinic.pyT)expect_successc                   t          j        t          j        d| j        g|ddt           j        t           j                  5 }|                                 |r=|j        r6|                     d	                    g |j
        |j                             |j
                                        }|j                                        }|                     |d           |cd d d            S # 1 swxY w Y   d S )Nz-Xutf8utf-8r   )encodingbufsizer   stderrrD   )
subprocessPopenr`   
executable	clinic_pyPIPEwait
returncoder  joinr   r  readr   )r   r  r)   procr   r  s         r   _do_testzClinicExternalTest._do_test'  s-   ^Xt~==??
 
 
 	 IIKKK A$/ A		"''">DK">$+">??@@@[%%''F[%%''FVR(((	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   BC,,C03C0c                      | j         | S r   r  r   r)   s     r   r  z!ClinicExternalTest.expect_success8  s    t}d##r   c                      | j         |ddiS )Nr  Fr   r  s     r   ry   z!ClinicExternalTest.expect_failure;  s    t}d95999r   c                    d}t          j        |          }t          |dd          5 }|                                }d d d            n# 1 swxY w Y   |                     t
          t                     |                     ddt          |          }|                     |d           t          t          dd          5 }|                                }d d d            n# 1 swxY w Y   |                     ||           d S )Nzclinic.test.cr   r  r  -f-orD   )	r   findfileopenr  
addCleanupr	   r   r  r   )r   CLINIC_TESTsourcer  orig_contentsr   new_contentss          r   test_externalz ClinicExternalTest.test_external>  sb   %!+..&#000 	%AFFHHM	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	'''!!$ff==b!!!&#000 	$A6688L	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	}55555s#   A

AA?C  C$'C$c                    t          d          }t          j                    5 }t          j                            |d          }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   t          j        |          j	        }| 
                    |           t          j        |          j	        }d d d            n# 1 swxY w Y   |                     ||           d S )Nz
            /*[clinic input]
            [clinic start generated code]*/
            /*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/
        rr   wr  r  )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_changeN  sX       
 !! 	1Wgx00Bb#000 A              /I###0J	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	J/////s6   3CA8,C8A<	<C?A<	 A
CCCc                    t          d          }t          d          }t          j                    5 }t          j                            |d          }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   |                     |          }| 	                    |
                    |                     |                     d|          }|                     |d           d	}t          |d
d          5 }|                                }d d d            n# 1 swxY w Y   | 	                    |
                    |                     d d d            d S # 1 swxY w Y   d S )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.
        rr   r  r  r  r  rD   zP/*[clinic end generated code: output=6c2289b73f32bc19 input=9543a8d2da235301]*/
r   )r
   r   r  r'  r/  r  r  r  ry   r   endswithr  r   r  )	r   invalid_inputfail_msgr  r   r  r   checksum	generateds	            r   test_cli_forcez!ClinicExternalTest.test_cli_forceb  s+    
  
 
     !! 	:Wgx00Bb#000 'A&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' '
 %%b))COOCLL22333%%dB//CS"%%%F  b#000 %AFFHH	% % % % % % % % % % % % % % %OOI..x88999'	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:sZ   3E0%B;E0B	E0B	B E0D0$E00D4	4E07D4	8+E00E47E4c                    t          d          }d}d}d}d }t          j                    5 } ||||            ||||           t          j                            |d          }t          j        |          5 } ||||           |                     dd	d
|          }	d d d            n# 1 swxY w Y   |D ]f}
|                     |
          5  t          j                            ||
          }|                     ||	           d d d            n# 1 swxY w Y   g|D ]f}
|                     |
          5  t          j                            ||
          }| 	                    ||	           d d d            n# 1 swxY w Y   g|D ]f}
|                     |
          5  t          j                            ||
          }| 	                    ||	           d d d            n# 1 swxY w Y   g	 d d d            d S # 1 swxY w Y   d S )NzR
            /*[clinic input]
            [clinic start generated code]*/
        pass)zfile1.czfile2.c)zfile1.pyzfile2.pyc                     | D ]a}t           j                            ||          }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   bd S )Nr  r  r  )r'  r/  r  r  r  )filessrcdirr  r   r/  r  s         r   create_filesz6ClinicExternalTest.test_cli_make.<locals>.create_files  s     " "w||FB//$g666 "!GGDMMM" " " " " " " " " " " " " " "" "s   AA	 A		externals)r/  -v--make--srcdirrs   )
r
   r   r  r'  r/  r  r  r   r   assertNotIn)r   c_codepy_codec_filespy_filesr&  r  ext_pathr'  r   r@   r/  s               r   test_cli_makez ClinicExternalTest.test_cli_make  s       &)	" 	" 	" !! 	0WL'6222L7G444 w||G[99H#222 OiWi888 ))$*gNN	O O O O O O O O O O O O O O O $ - -\\8\44 - -7<<::DMM$,,,- - - - - - - - - - - - - - - % 0 0\\8\44 0 07<<::D$$T3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 $ 0 0\\8\44 0 07<<(;;D$$T3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 00/	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s   AH<&B."H.B2	2H5B2	6H7D
HDHDH<7E?3H?FHFH%7G(H(G,,H/G,0HH	Hc                    t          j                    5 }t          j                            |d          }t          |dd          5 }|                    d           d d d            n# 1 swxY w Y   |                     d|          }|                     |	                                |           d d d            d S # 1 swxY w Y   d S )Nrr   r  r  r  rD   r(  )
r   r  r'  r/  r  r  r  r  r   rv   )r   r  r   r  r   s        r   test_cli_verbosez#ClinicExternalTest.test_cli_verbose  s0   !! 	.Wgx00Bb#000 A              %%dB//CSYY[["---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s6   3B?A)B?)A-	-B?0A-	1AB??CCc                 \    |                      d          }|                     d|           d S )Nz-husage: clinic.py)r  r   r  s     r   test_cli_helpz ClinicExternalTest.test_cli_help  s0    !!$''(#.....r   c           	         t          d          }d}t          d          }|                     d          }|                     |                    |          |           |                     |                    |          |           |                    |          }|                    |          }|                    d          }t          ||          D ]v\  }}|	                                }| 
                    |          5  |                     |                    |          d|d|           d d d            n# 1 swxY w Y   wd S )	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()
                NoneType()
                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   )r3  zexpected converter z, got )r
   r  r   r   r  removeprefixremovesuffixr   zipr   r   )r   preludeexpected_convertersfinaler   linesr3  lines           r   test_cli_convertersz&ClinicExternalTest.test_cli_converters  s      
<    " !!.11
 	w//555V,,c222w''v&&		$"#6>> 	 	OIt;;==D	22  OOI..E)EETEE                	 	s   0EE		E	c                 b    |                      dd          }d}|                     ||           d S )NrS  rr   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_filename  s=    !!.(;;. 	 	c3r   c                 Z    |                                  }|                     d|           d S )Nr5  r   r  s     r   test_cli_fail_no_filenamez,ClinicExternalTest.test_cli_fail_no_filename  s.    !!##(#.....r   c                 f    |                      dddd          }d}|                     ||           d S )Nr  out.czinput.czmoreinput.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_files  s:    !!$MJJAc3r   c                     dD ]V}|                      |          5   | j        dg|R  }d}|                     ||           d d d            n# 1 swxY w Y   Wd S )N))r  rb  )z
filename.c)optsr)  z2Usage error: can't use -o or filenames with --make)r   ry   r   )r   re  r   r   s       r   )test_cli_fail_filename_or_output_and_makez<ClinicExternalTest.test_cli_fail_filename_or_output_and_make  s    4 	( 	(D4(( ( ()d)(:T:::Jc3'''( ( ( ( ( ( ( ( ( ( ( ( ( ( (	( 	(s   'AA	A	c                 d    |                      ddd          }d}|                     ||           d S )Nr)  r*  rD   z3Usage error: --srcdir must not be empty with --maker   r   s      r   !test_cli_fail_make_without_srcdirz4ClinicExternalTest.test_cli_fail_make_without_srcdir#  s8    !!(J;;Cc3r   )r    r!   r"   r#   r'  r/  r  r   toolsdirr  r  r  ry   r  r  r   r1  r3  r6  r\  r^  r`  rc  rf  rh  r$   r   r   r  r  #  s'       GZ0(KHHI-1     "$ $ $: : :6 6 6 0 0 0(&: &: &:P)0 )0 )0V. . ./ / /H H HT     / / /     
( ( (         r   r  z_testclinic is missingc                      e Zd Z e                                d  ee          D                        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 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! 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 Z7d3S )4ClinicFunctionalTestc              #   n   K   | ]0}|                     d           |t          t          |          fV  1dS )test_N)r   getattr	ac_tester).0r(   s     r   	<genexpr>zClinicFunctionalTest.<genexpr>0  s^       L L$//'2J2JLT79d334 L L L L L Lr   c                    |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        g d          g df           |                     t          j        d          d           d S )NrO  r{   rO  r{   zwhatever class)rO  N)r   	TypeErrorro  objects_converterr   r9   s    r   test_objects_converterz+ClinicFunctionalTest.test_objects_converter3  s    y)) 	* 	*')))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*4Q::FCCC4R9IJJRQaLbccc4Q77CCCCC   ;??c                     |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        d          d           d S )NrO     BytesObject)ry  )r   rt  ro  bytes_object_converterr   r9   s    r   test_bytes_object_converterz0ClinicFunctionalTest.test_bytes_object_converter:  s    y)) 	0 	0,Q///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	09.IIK\]]]]]   <A A c                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   t	          d          }|                     t          j        |          |f           d S )NrO  s   ByteArrayObject)r   rt  ro  byte_array_object_converter	bytearrayr   )r   byte_arrs     r    test_byte_array_object_converterz5ClinicFunctionalTest.test_byte_array_object_converter?  s    y)) 	5 	51!444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5/00>xHH8+VVVVVr|  c                     |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        d          d           d S )NrO  rM  )rM  )r   rt  ro  unicode_converterr   r9   s    r   test_unicode_converterz+ClinicFunctionalTest.test_unicode_converterE  s    y)) 	+ 	+'***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+4Y??NNNNNr|  c                    |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        dg d          d           |                     t          j        ddd	id
          d           d S )NFz	not a int)TTTrD      )FFT)z	not emptyrO  r{   r   )TTF)r   rt  ro  bool_converterr   r9   s    r   test_bool_converterz(ClinicFunctionalTest.test_bool_converterJ  s   y)) 	@ 	@$UE;???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@1335GHHH1"b!<<>RSSS1.1a&!LLNabbbbbs   >AAc                 $   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   g d}t	          d |D                       }|                     t          j                    |           g d}t	          d |D                       }|                     t          j        | |           d S )NrO  s   ab)   A         	   
            "   '   ?   \       c              3   4   K   | ]}t          |          V  d S r   ordrp  r   s     r   rq  z;ClinicFunctionalTest.test_char_converter.<locals>.<genexpr>W  (      //AQ//////r   )   1   2   3   4   5   6   7   8   9   0   a   b   c   dc              3   4   K   | ]}t          |          V  d S r   r  r  s     r   rq  z;ClinicFunctionalTest.test_char_converter.<locals>.<genexpr>Z  r  r   )r   rt  ro  char_convertertupler   )r   charsr   s      r   test_char_converterz(ClinicFunctionalTest.test_char_converterQ  s   y)) 	( 	($Q'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(y)) 	, 	,$U+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,rrr///////133X>>>ddd///////1598DDDDD!   <A A !BB	Bc                 ^   ddl m} |                     t                    5  t	          j        d           d d d            n# 1 swxY w Y   |                     t                    5  t	          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        d|dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        g            d d d            n# 1 swxY w Y   |                     t	          j                    d           |                     t	          j        dd|dz             d           |                     t	          j        dd|dz   dz  dz             d	           d S )
Nr   )	UCHAR_MAXr   rO     "   8   r   r   r   rE  {   r   r   r  )	_testcapir  r   OverflowErrorro  unsigned_char_converterrt  r   )r   r  s     r   test_unsigned_char_converterz1ClinicFunctionalTest.test_unsigned_char_converter]  s   ''''''}-- 	2 	2-b111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2}-- 	= 	=-i!m<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=}-- 	@ 	@-aQ???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@y)) 	2 	2-b111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2:<<lKKK:1aQOOQZ[[[:1a)a-STATWZAZ[[]hiiiiiG   AA	A'BBB0CCC:DD"Dc                 f   ddl m}m} |                     t                    5  t          j        |dz
             d d d            n# 1 swxY w Y   |                     t                    5  t          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j        d          d           |                     t          j        d          d           d S )Nr   )SHRT_MINSHRT_MAXrO  .r    )r  )	r  r  r  r   r  ro  short_converterrt  r   )r   r  r  s      r   test_short_converterz)ClinicFunctionalTest.test_short_converterk  s   00000000}-- 	4 	4%hl333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4}-- 	4 	4%hl333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4y)) 	* 	*%b)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*25998DDD2488'BBBBB5   AAA,BBB5CCCc                 ^   ddl m} |                     t                    5  t	          j        d           d d d            n# 1 swxY w Y   |                     t                    5  t	          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        d|dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        g            d d d            n# 1 swxY w Y   |                     t	          j                    d           |                     t	          j        dd|dz             d           |                     t	          j        dd|dz   dz  dz             d	           d S )
Nr   )	USHRT_MAXr   rO  r  r  rE  r  r  )	r  r  r   r  ro  unsigned_short_converterr  rt  r   )r   r  s     r   test_unsigned_short_converterz2ClinicFunctionalTest.test_unsigned_short_converterv  s   ''''''z** 	3 	3.r222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3}-- 	> 	>.y1}===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>}-- 	A 	A.q)a-@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	Ay)) 	3 	3.r222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3;==|LLL;Aq)a-PPR[\\\;Aq9q=TUBUX[B[\\^ijjjjjr  c                    ddl m}m} |                     t                    5  t          j        |dz
             d d d            n# 1 swxY w Y   |                     t                    5  t          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        ddd          ddt          d          f           d S )Nr   )INT_MININT_MAXrO  r{   rE  )r  r  -   3)
r  r  r  r   r  ro  r4  rt  r   r  )r   r  r  s      r   test_int_converterz'ClinicFunctionalTest.test_int_converter  se   ........}-- 	1 	1#GaK000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1}-- 	1 	1#GaK000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1y)) 	- 	-#Aq!,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-y)) 	( 	(#B'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(022LAAA0As;;aCHH=MNNNNNsG   AAA,BBB5CCC=DD"%D"c                 ^   ddl m} |                     t                    5  t	          j        d           d d d            n# 1 swxY w Y   |                     t                    5  t	          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        d|dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        g            d d d            n# 1 swxY w Y   |                     t	          j                    d           |                     t	          j        dd|dz             d           |                     t	          j        dd|dz   dz  dz             d	           d S )
Nr   )UINT_MAXr   rO  r  r  rE  r  r  )	r  r  r   r  ro  unsigned_int_converterr  rt  r   )r   r  s     r   test_unsigned_int_converterz0ClinicFunctionalTest.test_unsigned_int_converter  s   &&&&&&z** 	1 	1,R000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1}-- 	; 	;,X\:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;}-- 	> 	>,Q1===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>y)) 	1 	1,R000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	19;;\JJJ9!Q1MMyYYY9!QAQR@RUX@XYY[fgggggr  c                 d   ddl m}m} |                     t                    5  t          j        |dz
             d d d            n# 1 swxY w Y   |                     t                    5  t          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        d          d           d S )Nr   )LONG_MINLONG_MAXrO  r  r  r  )	r  r  r  r   r  ro  long_converterrt  r   )r   r  r  s      r   test_long_converterz(ClinicFunctionalTest.test_long_converter  s   00000000}-- 	3 	3$X\222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3}-- 	3 	3$X\222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3y)) 	) 	)$R(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)133U;;;1%88(CCCCCr  c                 ^   ddl m} |                     t                    5  t	          j        d           d d d            n# 1 swxY w Y   |                     t                    5  t	          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        d|dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        g            d d d            n# 1 swxY w Y   |                     t	          j                    d           |                     t	          j        dd|dz             d           |                     t	          j        dd|dz   dz  dz             d	           d S )
Nr   )	ULONG_MAXr   rO  r  r  rE  r  r  )	r  r  r   r  ro  unsigned_long_converterr  rt  r   )r   r  s     r   test_unsigned_long_converterz1ClinicFunctionalTest.test_unsigned_long_converter  s   ''''''z** 	2 	2-b111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2}-- 	= 	=-i!m<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=}-- 	@ 	@-aQ???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@y)) 	2 	2-b111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2:<<lKKK:1aQOOQZ[[[:1a)a-STATWZAZ[[]hiiiiir  c                 d   ddl m}m} |                     t                    5  t          j        |dz
             d d d            n# 1 swxY w Y   |                     t                    5  t          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        d          d           d S )Nr   )	LLONG_MIN	LLONG_MAXrO  r  r  r  )	r  r  r  r   r  ro  long_long_converterrt  r   )r   r  r  s      r   test_long_long_converterz-ClinicFunctionalTest.test_long_long_converter  s   22222222}-- 	9 	9))a-888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9}-- 	9 	9))a-888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9y)) 	. 	.)"---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.688%@@@6u==xHHHHHr  c                 ^   ddl m} |                     t                    5  t	          j        d           d d d            n# 1 swxY w Y   |                     t                    5  t	          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        d|dz              d d d            n# 1 swxY w Y   |                     t                    5  t	          j        g            d d d            n# 1 swxY w Y   |                     t	          j                    d           |                     t	          j        dd|dz             d           |                     t	          j        dd|dz   dz  dz             d	           d S )
Nr   )
ULLONG_MAXr   rO  r  r  rE  r  r  )	r  r  r   r  ro  unsigned_long_long_converterr  rt  r   )r   r  s     r   !test_unsigned_long_long_converterz6ClinicFunctionalTest.test_unsigned_long_long_converter  s   ((((((z** 	7 	722666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7}-- 	C 	C2:>BBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C}-- 	F 	F21j1nEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fy)) 	7 	722666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7?AA<PPP?1jSTnUUW`aaa?1zTU~YZFZ]`F`aacnooooor  c                 h   ddl m}m} |                     t                    5  t          j        |dz
             d d d            n# 1 swxY w Y   |                     t                    5  t          j        |dz              d d d            n# 1 swxY w Y   |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        ddd           d           d S )Nr   PY_SSIZE_T_MINPY_SSIZE_T_MAXrO  r  r{   rO  r{   r  )	r  r  r  r   r  ro  py_ssize_t_converterrt  r   r   r  r  s      r   test_py_ssize_t_converterz.ClinicFunctionalTest.test_py_ssize_t_converter  s   <<<<<<<<}-- 	? 	?*>A+=>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?}-- 	? 	?*>A+=>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?y)) 	/ 	/*2...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/799<HHH71dCCZPPPPPr  c                    ddl m}m} |                     t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        ddd           d           |                     t          j        ||dz   |dz             |||f           |                     t          j        ||dz
  |dz
            |||f           d S )Nr   r  r  rO  r{   r  i  )r  r  r  r   rt  ro  slice_index_converterr   r  s      r   test_slice_index_converterz/ClinicFunctionalTest.test_slice_index_converter  sj   <<<<<<<<y)) 	0 	0+B///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	08::LIII8AtDDjQQQ8Z[I[]knr]rss(..I	K 	K 	K8Z[I[]knr]rss(..I	K 	K 	K 	K 	Ks   AAAc                 l   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           d S )Nr   r  )r   r  ro  size_t_converterrt  r   r9   s    r   test_size_t_converterz*ClinicFunctionalTest.test_size_t_converter  s   z** 	+ 	+&r***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+y)) 	+ 	+&r***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+355u=====r  c                 0   |                      t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        d          d           d S N)g      )@      ࿩r  )r   rt  ro  float_converterr   r9   s    r   test_float_converterz)ClinicFunctionalTest.test_float_converter  s    y)) 	* 	*%b)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*244g>>>2488'BBBBBr|  c                 0   |                      t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j                    d           |                     t          j        d          d           d S r  )r   rt  ro  double_converterr   r9   s    r   test_double_converterz*ClinicFunctionalTest.test_double_converter  s    y)) 	+ 	+&r***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+355w???3D997CCCCCr|  c                 B   |                      t                    5  t          j        g            d d d            n# 1 swxY w Y   |                     t          j        t          dd                    t          dd          f           |                     t          j        t          d                    t          d          f           |                     t          j        d          d           |                     t          j        d          d           d S )NrO  r{   z-1-2jr  r  
   )r  )r   rt  ro  py_complex_converterr   complexr9   s    r   test_py_complex_converterz.ClinicFunctionalTest.test_py_complex_converter  s/   y)) 	/ 	/*2...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/71FFQRTUHXYYY78H8HIIGT[L\L\K^___7==wGGG7;;UCCCCCr|  c                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t          j        ddd          d           |                     t          j        ddd          d           |                     t          j        ddd	          d
           d S )NrO  r   r   r      b br  r   r  c cr   r   r  )r   rt  ro  rG  r  r   r9   s    r   test_str_converterz'ClinicFunctionalTest.test_str_converter  s   y)) 	' 	'#A&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'y)) 	3 	3#Cc222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3z** 	7 	7#C#666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	70dC@@/RRR0dDAA?SSS0dFCCEWXXXXXs3   <A A !BBB)CCCc                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        ddd          d           |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t          j        ddt          t          d          g                    d           |                     t          j        ddt          t          d          dt          d          g                    d	           |                     t          j        ddd
          d	           d S )NrO  r   r   r   r   r  r  r   r  s   c c)r   rt  ro  str_converter_encodingr   r  r  r9   s    r   test_str_converter_encodingz0ClinicFunctionalTest.test_str_converter_encoding  s   y)) 	0 	0,Q///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	09#sCHH/ZZZy)) 	@ 	@,S'3???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@9#tYPSTWPXPXzEZEZ[[]lmmm9#tYPSTWPXPXZ[]`ad]e]eOfEgEghh-	/ 	/ 	/9#tYOOQefffffs!   <A A B..B25B2c           	         |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dt          g d                    d           d S )Nr   r   abcrO  r{   rE  )s   abcs   )r   rt  ro  py_buffer_converterr   r  r9   s    r   test_py_buffer_converterz-ClinicFunctionalTest.test_py_buffer_converter  s    y)) 	4 	4)#s333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	46ui			>R>RSSUnooooo   =AAc                     |                      t          j        dd          d           |                      t          j        dd          d           |                      t          j        dd          d           d S )NrO  r{   rs  r   r   )r   ro  keywordsr9   s    r   test_keywordsz"ClinicFunctionalTest.test_keywords  sw    +Aq116:::+A333V<<<+a1555v>>>>>r   c                 <   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        dd          d           d S )NrO  r{   r  rs  r   )r   rt  ro  keywords_kwonlyr   r9   s    r   test_keywords_kwonlyz)ClinicFunctionalTest.test_keywords_kwonly"  s    y)) 	, 	,%a+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,21:::FCCC2Q!<<<fEEEEEr  c                 P   |                      t          j        d          d           |                      t          j        dd          d           |                      t          j        ddd          d           |                      t          j        dd          d           |                      t          j        ddd          d           |                      t          j        dd	          d
           |                      t          j        ddd          d           d S )NrO  rO  NNr{   rO  r{   NrE  r  r  r   r   r   rO  NrE  r   )r   ro  keywords_optr9   s    r   test_keywords_optz&ClinicFunctionalTest.test_keywords_opt(  s   /22ODDD/155|DDD/1a88)DDD/Q777FFF/1:::IFFF/!q999<HHH/!qA>>>	JJJJJr   c                    |                      t          j        d          d           |                      t          j        dd          d           |                     t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                      t          j        dd          d           |                      t          j        ddd          d           |                      t          j        dd	          d
           |                      t          j        dddd          d           d S )NrO  rO  NNNr{   rO  r{   NNrE  r  r  rO  r{   rE  Nr  )rO  NrE  N   r   r   r   r^   rO  r{   rE  r&  )r   ro  keywords_opt_kwonlyr   rt  r9   s    r   test_keywords_opt_kwonlyz-ClinicFunctionalTest.test_keywords_opt_kwonly1  sl   6q99;PQQQ6q!<<>PQQQy)) 	3 	3)!Q222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	36qA>>>@RSSS6q!qAAA?SSS6a@@@BTUUU6a1JJJLYYYYYs   ,BBBc                    |                      t          j        d          d           |                     t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t          j        dd          d           |                      t          j        dd          d           |                      t          j        ddd	          d
           d S )NrO  r  r{   r  r  rE  r  r  r   r  )r   ro  keywords_kwonly_optr   rt  r9   s    r   test_keywords_kwonly_optz-ClinicFunctionalTest.test_keywords_kwonly_opt;  s   6q99?KKKy)) 	0 	0)!Q///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	06qA>>>MMM6a@@@,OOO6a1EEEyQQQQQs   A%%A),A)c                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        dd          d           d S )NrO  r{   r   rs  r  )r   rt  ro  posonly_keywordsr   r9   s    r   test_posonly_keywordsz*ClinicFunctionalTest.test_posonly_keywordsC  sJ   y)) 	* 	*&q)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*y)) 	1 	1&a0000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	13Aq996BBB3A;;;VDDDDDs!   <A A !BBBc                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dd          d           d S )NrO  r{   r   r  rs  )r   rt  ro  posonly_kwonlyr   r9   s    r   test_posonly_kwonlyz(ClinicFunctionalTest.test_posonly_kwonlyK  s   y)) 	( 	($Q'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(y)) 	+ 	+$Q***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+y)) 	/ 	/$qA....	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/1!q9996BBBBBs3   <A A !BB
B(CCCc                 `   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t          j        ddd          d           |                     t          j        ddd          d           d S )NrO  r{   rE  r   r  r  r   r   )r   rt  ro  posonly_keywords_kwonlyr   r9   s    r   test_posonly_keywords_kwonlyz1ClinicFunctionalTest.test_posonly_keywords_kwonlyT  s   y)) 	1 	1-a000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1y)) 	7 	7-aA666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7y)) 	= 	=-Q!<<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=:1a1EEEyQQQ:1QGGGSSSSSs3   <A A !BBB)CCCc                 $   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        ddd          d           |                     t          j        dddd          d           |                     t          j        dd          d           |                     t          j        ddd	          d           |                      t                    5  t          j        dddd
           d d d            n# 1 swxY w Y   |                     t          j        dddd          d           d S )NrO  r{   r$  rE  r%  r&  r(  r  r  r'  r   r   r^   )r   rt  ro  posonly_keywords_optr   r9   s    r   test_posonly_keywords_optz.ClinicFunctionalTest.test_posonly_keywords_opt^  s   y)) 	. 	.*1---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.71==?QRRR71a@@/RRR71aCC\RRR7Q???ASTTT71BBBOTTTy)) 	? 	?*Q!qA>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?7Q!qIII<XXXXXs!   <A A 4EE Ec                 &   |                      t          j        d          d           |                      t          j        dd          d           |                      t          j        ddd          d           |                      t          j        dddd          d           |                     t                    5  t          j        dd	           d d d            n# 1 swxY w Y   |                      t          j        ddd
          d           |                      t          j        dddd          d           |                     t                    5  t          j        dddd           d d d            d S # 1 swxY w Y   d S )NrO  r#  r{   r$  rE  r%  r&  r(  r  r  r   r^   r'  )r   ro  posonly_opt_keywords_optr   rt  r9   s    r   test_posonly_opt_keywords_optz2ClinicFunctionalTest.test_posonly_opt_keywords_optj  s   ;A>>@UVVV;AqAACUVVV;Aq!DDoVVV;Aq!QGGVVVy)) 	7 	7.qA6666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7;AqAFFFXXX;AqAKKK\ZZZy)) 	C 	C.a1BBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cs$   C$$C(+C( FF
F
c                    |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        ddd          d           |                     t          j        dddd	          d
           |                      t                    5  t          j        dddd           d d d            d S # 1 swxY w Y   d S )NrO  r{   r  r$  rE  r5  r%  r&  r9  r(  r'  )r   rt  ro  posonly_kwonly_optr   r9   s    r   test_posonly_kwonly_optz,ClinicFunctionalTest.test_posonly_kwonly_optv  s   y)) 	, 	,(+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,y)) 	/ 	/(A...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/5a1===?QRRR5a1BBBOTTT5a1QGGGVVVy)) 	= 	=(1Q!<<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=s3   <A A !BB
B)EEEc                 v   |                      t          j        d          d           |                      t          j        dd          d           |                     t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t          j        ddd          d           |                      t          j        dddd	
          d           d S )NrO  r#  r{   r$  rE  r  r  r%  r&  r=  r(  )r   ro  posonly_opt_kwonly_optr   rt  r9   s    r   test_posonly_opt_kwonly_optz0ClinicFunctionalTest.test_posonly_opt_kwonly_opt  s   9!<<>STTT9!Q??ASTTTy)) 	6 	6,Q1555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6y)) 	5 	5,Q!4444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	59!Q!DDDoVVV9!Q!qIII<XXXXXs$   ,BBB4CCCc           	      0   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        ddd           d d d            n# 1 swxY w Y   |                     t          j        ddd          d           |                     t          j        ddd          d           |                     t          j        dddd	
          d           |                     t          j        dddd	d          d           d S )NrO  r{   r  rE  r   r  rO  r{   rE  NNr5  r&  r=  rO  r{   rE  r&  Nr  r   r^   erO  r{   rE  r&  r  )r   rt  ro  posonly_keywords_kwonly_optr   r9   s    r    test_posonly_keywords_kwonly_optz5ClinicFunctionalTest.test_posonly_keywords_kwonly_opt  s8   y)) 	5 	51!444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5y)) 	8 	81!Q777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8y)) 	: 	:1!q9999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:y)) 	; 	;1!Q:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;y)) 	A 	A1Aa@@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A>q!qIIIK`aaa>qAKKKMbccc>q!qANNNPbccc>q!qAQRSSSUdeeeeesW   <A A !BB
B(CCC0DDD8EE #E c           	      j   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        dd          d           |                      t                    5  t          j        dddd           d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        ddd          d	           |                     t          j        ddd
          d	           |                     t          j        dddd          d           |                     t          j        dddd          d           |                     t          j        ddddd          d           |                     t          j        ddddd          d           d S )NrO  r{   )rO  r{   NNNr  rE  r&  r   r  rG  r5  r^   rH  r=  r  r^   rJ  rK  rI  )r   rt  ro  posonly_keywords_opt_kwonly_optr   r9   s    r   $test_posonly_keywords_opt_kwonly_optz9ClinicFunctionalTest.test_posonly_keywords_opt_kwonly_opt  s   y)) 	9 	95a888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9B1aHHJbcccB1JJJLdeeey)) 	B 	B5aAqAAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	By)) 	@ 	@5Q????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@B1a1MMMOdeeeB1QOOOQfgggB1aaPPPRdeeeB1a1PQRRRTfgggB1aaSTUUUWfgggB1a1PQUVWWWYhiiiiis3   <A A 4CCC=D  D$'D$c                 &   |                      t          j        d          d           |                      t          j        dd          d           |                     t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                      t          j        ddd          d           |                      t          j        ddd          d           |                      t          j        dddd	
          d           |                      t          j        dddd	          d           |                     t                    5  t          j        dddd	           d d d            d S # 1 swxY w Y   d S )NrO  r#  r{   r$  r  rE  r%  r  r&  rO  r(  r=  )r   ro  #posonly_opt_keywords_opt_kwonly_optr   rt  r9   s    r   (test_posonly_opt_keywords_opt_kwonly_optz=ClinicFunctionalTest.test_posonly_opt_keywords_opt_kwonly_opt  s"   FqIIK`aaaFq!LLN`aaay)) 	B 	B9!qAAAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	BFq!QOOQ`aaaFq!qQQQSbcccFq!QRSTTTVbcccFq!qTUVVVXdeeey)) 	F 	F9!Q1EEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fs$   ,BBB!FF
F
c                 n   |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                      t                    5  t          j        d           d d d            n# 1 swxY w Y   |                     t          j        d          d           d S )NrO  r   rO  )r   rt  ro  keyword_only_parameterr   r9   s    r   test_keyword_only_parameterz0ClinicFunctionalTest.test_keyword_only_parameter  s   y)) 	/ 	/,...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/y)) 	0 	0,Q///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	09A>>>EEEEEs   ;?? BBBc                    |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        dd          d           |                     t          j        dddd          d           d S )NrO  r{   )rO  r{   r$   r  rE  r&  )rO  r{   )rE  r&  )r   rt  ro  posonly_varargr   r9   s    r   test_posonly_varargz(ClinicFunctionalTest.test_posonly_vararg  s    y)) 	' 	'$&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'1!Q77DDD1!q999:FFF1!Q1==~NNNNNrw  c                 v   |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dddd          d           d S NrO  r{   r  rE  r&  )rO  r{   rE  r&  )r   rt  ro  vararg_and_posonlyr   r9   s    r   test_vararg_and_posonlyz,ClinicFunctionalTest.test_vararg_and_posonly  s&   y)) 	+ 	+(***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+y)) 	1 	1(a0000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	15aAqAA>RRRRR   ;?? BB
Bc                 v   |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                      t                    5  t          j        dd           d d d            n# 1 swxY w Y   |                     t          j        dddd          d           d S r^  )r   rt  ro  varargr   r9   s    r   test_varargz ClinicFunctionalTest.test_vararg  s&   y)) 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	% 	%Q!$$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%)!Q155~FFFFFrb  c           	         |                      t                    5  t          j                     d d d            n# 1 swxY w Y   |                     t          j        dd          d           |                     t          j        dddd          d           |                     t          j        ddddd	          d
           d S )NrO  Fr  )rO  r$   Fr{   rE  r&  )rO  r_  FT)rO  r_  T)r   rt  ro  vararg_with_defaultr   r9   s    r   test_vararg_with_defaultz-ClinicFunctionalTest.test_vararg_with_default  s    y)) 	, 	,)+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,6qEBBBNSSS6q!QBBDYZZZ6q!QTJJJL`aaaaarw  c           	         |                      t          j                    d           |                      t          j        d          d           |                      t          j        dd          d           |                      t          j        dddd          d	           |                      t          j        ddddd
          d           d S )N)r$   Nr{   r  )r$   r{   rO  )rW  r{   rE  r&  )r(  Nr  )r(  r  )r   ro  vararg_with_only_defaultsr9   s    r   test_vararg_with_only_defaultsz3ClinicFunctionalTest.test_vararg_with_only_defaults  s    <>>
KKK<qAAA7KKK<Q!DDDjQQQ<Q1aHHJ^___<Q1a1MMMO`aaaaar   c                 :    t          j        dddddd           d S )NrO  r{   rE  r&  r     )kw1kw2)ro  gh_32092_oobr9   s    r   test_gh_32092_oobz&ClinicFunctionalTest.test_gh_32092_oob  s&    q!Qqa888888r   c                 2    t          j        ddd           d S )NrO  r{   rE  )ro  gh_32092_kw_passr9   s    r   test_gh_32092_kw_passz*ClinicFunctionalTest.test_gh_32092_kw_pass  s    "1a+++++r   c                     d}t          j        |          }t          j        |           t          j        |          }|                     ||           d S )Nz5*A unique string is not referenced by anywhere else.*)r`   getrefcountro  gh_99233_refcountr   )r   argarg_refcount_originarg_refcount_afters       r   test_gh_99233_refcountz+ClinicFunctionalTest.test_gh_99233_refcount  sV    E!oc22#C((( _S11,.@AAAAAr   c                     d}|                      t          |          5  t          j        dd           d d d            d S # 1 swxY w Y   d S )NzVgh_99240_double_free\(\) argument 2 must be encoded string without null bytes, not strr   z b)r  rt  ro  gh_99240_double_free)r   expected_errors     r   test_gh_99240_double_freez.ClinicFunctionalTest.test_gh_99240_double_free  s    r##I~>> 	7 	7*3666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   AAAN)8r    r!   r"   localsupdatedirro  rv  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-  r0  r3  r7  r;  r?  rB  rE  rM  rR  rU  rY  r\  ra  re  rh  rk  rq  rt  r{  r  r$   r   r   rk  rk  .  s       
FHHOO L L #IL L L L L LD D D^ ^ ^
W W WO O O
c c c
E 
E 
Ej j j	C 	C 	Ck k kO O Oh h h	D 	D 	Dj j j	I 	I 	Ip p p	Q 	Q 	Q	K 	K 	K> > >C C CD D DD D D	Y 	Y 	Y	g 	g 	gp p p
? ? ?
F F FK K KZ Z ZR R RE E EC C CT T T
Y 
Y 
Y
C 
C 
C	= 	= 	=Y Y Yf f f j j j 
F 
F 
FF F FO O OS S SG G Gb b bb b b9 9 9, , ,B B B7 7 7 7 7r   rk  c                   $    e Zd ZdZd Zd Zd ZdS )PermutationTestsz#Test permutation support functions.c                     d}t          t          g d                    }t          t          j        |                    }|                     ||           d S )N)r$   )rE  )r{   rE  r  r  )r  rV  r  r   permute_left_option_groupsr   r   r   datar  s       r   test_permute_left_option_groupsz0PermutationTests.test_permute_left_option_groups  sV    
 C			NN##v8>>??*****r   c                     d}t          t          g d                    }t          t          j        |                    }|                     ||           d S )N)r$   rW  rs  r  r  )r  rV  r  r   permute_right_option_groupsr   r  s       r    test_permute_right_option_groupsz1PermutationTests.test_permute_right_option_groups  sV    
 C			NN##v9$??@@*****r   c           	         ddddd}ddddd}dddd	d}ddd
dd}ddddd}ddddd}ddddd}ddddd}ddddd}	|||||||||	f	}
|
D ]{} | j         di |5  |                                \  }}}}t          j        |||          }t	          |          }|                     ||           d d d            n# 1 swxY w Y   |d S )Nr$   )r$   )leftrequiredrightr   r  r  )r  r5  r5  rO  )r5  r9  rP  )r5  r9  )r   r   r^   rJ  r   )r  r   )r5  r   r   )r  r5  r   )r  r   r   r=  )rJ  r  )r=  r9  r'  )r   r   r   r^   rJ  )r   r   r   r^   rJ  r  )r   valuesr   r   r  r   )r   emptynoleft1noleft2noleft3noright1noright2noright3leftandright1leftandright2rt  paramsr  r  r  r   permutationsr  s                     r   test_permute_optional_groupsz-PermutationTests.test_permute_optional_groups  s   B
 

 FV
 
 K&
 
 K*
 
 
 
 
R
 
 FR
 
 
 
 J	
 	
 Wgh=	
  	3 	3F'''' 3 328--///hx%=dHeTT|,,  222	3 3 3 3 3 3 3 3 3 3 3 3 3 3 3	3 	3s   AB==C	C	N)r    r!   r"   __doc__r  r  r  r$   r   r   r  r    sL        --	+ 	+ 	+	+ 	+ 	+N3 N3 N3 N3 N3r   r  __main__)/testr   r   test.supportr   r   r   test.support.os_helperr   r	   textwrapr
   unittestr   rU   re  os.pathr'  r  r`   skip_if_missingimports_under_toolr   r   r   r&   r-   r6   rm   r   rB   rp   r   r   r   r  r	  r   r  _testclinicro  ImportErrorskipIfrk  r  r    mainr$   r   r   <module>r     s  
 % $ $ $ $ $ $ $ " " " " " " ; ; ; ; ; ; ; ; 1 1 1 1 1 1 1 1                       



  
 8 $ $ $"Z"8,, ! !MMM      ! ! ! ! ! ! ! ! ! ! ! ! ! ! !

G 
G 
G 
G 
G( 
G 
G 
G       0 0 0 0 0 0 0 0Q Q Q Q Q Q Q Q FM36222-8 -8 -8 -8 -8 -8 -8 -8`c  c  c  c  c + c  c  c L-. -. -. -. -.h -. -. -.`2& 2& 2& 2& 2&X 2& 2& 2&h       # # # # # # # #: : : : :H : : :z^+ ^+ ^+ ^+ ^+{ ^+ ^+ ^+BC  C  C  C  C  C  C  C L#####   III d"$<==B7 B7 B7 B7 B78, B7 B7 >=B7Jg3 g3 g3 g3 g3x( g3 g3 g3T zHMOOOOO s$   #A::A>A>E EE