+
    eil  c                   s   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
t
^ RIHt ^ RIHt ^RIHt R t]! RR	4      tROR
 lt]
P*                  ! RR7      R 4       t]
P*                  ! RR7      R 4       t]
P*                  ! RR7      R 4       t]
P*                  ! RR7      R 4       t]
P*                  ! RR7      R 4       t]
P*                  ! RR7      R 4       tR tR tR tR tR t R t!]
PD                  PG                  ]PH                  RP8*  RR7      R 4       t%]
PD                  PG                  ] PL                  ! 4       R8g  ;'       g    ]PH                  RP8*  RR7      R 4       t']
PD                  PP                  R 4       t)R  t*R! t+R" t,R# t-R$ t.R% t/R& t0R' t1R( t2R) t3R* t4R+ t5R, t6R- t7]
PD                  Pq                  R.R7      R/ 4       t9R0 t:R1 t;R2 t<R3 t=R4 t>R5 t?R6 t@R7 tAR8 tB]
PD                  Pq                  R.R7      R9 4       tC]
PD                  PG                  ] PL                  ! 4       R8g  ;'       g    ]PH                  RP8*  R:R7      R; 4       tD]
PD                  PG                  ] PL                  ! 4       R8g  ;'       g    ]PH                  RP8*  R:R7      R< 4       tER= tFR> tGR? tHR@ tIRA tJRB tKRC tLRD tMRE tNRF tORG tPRH tQRI tRRJ tSRK tTRL tURM tVRN tWR# )Qi    N)
namedtuple)Path)main)NOGIL_BUILD)utilc                  s    \         P                  ! 4       '       g   \        P                  ! R 4       R# \	        4        R# )z$CLI command needs a Fortran compilerN)r   Zhas_fortran_compilerpytestskipf2pycli     C/usr/lib64/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.pycompiler_check_f2pyclir      s#    $$&&:;	r	   PPathsz(finp, f90inp, pyf, wrap77, wrap90, cmodfc                s    \        V 4      p\        VP                  R4      VP                  R4      VP                  R4      VP                  V R24      VP                  V R24      VP                  V R24      R7      # )a8  Takes in a temporary file for testing and returns the expected output and input paths

Here expected output is essentially one of any of the possible generated
files.

..note::

     Since this does not actually run f2py, none of these are guaranteed to
     exist, and module names are typically incorrect

Parameters
----------
fname_inp : str
            The input filename
mname : str, optional
            The name of the module, untitled by default

Returns
-------
genp : NamedTuple PPaths
        The possible paths which are generated, not all of which exist
z.fz.f90.pyfz-f2pywrappers.fz-f2pywrappers2.f90module.c)finpf90inppyfwrap77wrap90cmodf)r   r   Zwith_suffixZ	with_name)Z	fname_inpmnameZbpaths   && r
   get_io_pathsr   %   s~    . OEt$  (f%%89%(:;<oox01 r	   Zsession)Zscopec                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )'Generates a single f90 file for testingtestssrcclizhiworld.f90z	hello.f90asciiencodingr   Zgetpath	read_textZgetbasetemp
write_texttmpdir_factoryfdatfn   &  r
   hello_world_f90r'   L   sI     <<}=GGID		#	#	%	3BMM$M)Ir	   c                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )z(F90 file for testing warnings in gh23598r   r   Zcrackfortranzgh23598Warn.f90r   r   r   r"   r&   r
   gh23598_warnr)   U   sK     <<8IJTTVD		#	#	%(9	9BMM$M)Ir	   c                r(   )z8F90 file for testing disallowed CLI arguments in ghff819r   r   r   zgh_22819.pyfr   r   r   r"   r&   r
   gh22819_clir*   ^   sI     <<~>HHJD		#	#	%	6BMM$M)Ir	   c                r   )'Generates a single f77 file for testingr   r   r   zhi77.fzhello.fr   r   r   r"   r&   r
   hello_world_f77r,   g   sI     <<x8BBDD		#	#	%		1BMM$M)Ir	   c                r   )r+   r   r   Zreturn_realzfoo77.fzfoo.fr   r   r   r"   r&   r
   retreal_f77r-   p   sI     <<yAKKMD		#	#	%	/BMM$M)Ir	   c                sJ   \         P                  ! RRRR4      P                  4       p\         P                  ! RRRR4      P                  4       pV P                  4       R,          pV P                  4       R,          pVP	                  VRR	7       VP	                  VRR	7       V# )
r   r   r   f2cmapzisoFortranEnvMap.f90z.f2py_f2cmapz
f2cmap.f90Zmapfiler   r   r   )r#   r$   r.   r%   Zfmaps   &    r
   
f2cmap_f90r/   x   s     <<2HISSUD\\'5(NCMMOF		#	#	%	4B%%')3DMM$M)OOFWO-Ir	   c                s   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        VP                  P                  R4       Uu. uF&  qDP                  4       '       g   K  VP                  NK(  	  ppRV9  g   Q hRV9  g   Q hRV9   g   Q hRV9   g   Q h RRR4       R# u upi   + '       g   i     R# ; i)	zCheck that module names are handled correctly
gh-22819
Essentially, the -m name cannot be used to import the module, so the module
named in the .pyf needs to be used instead

CLI :: -m and a .pyf file
argvf2py -m blah Z*zblahmodule.czblah-f2pywrappers.fztest_22819-f2pywrappers.fztest_22819module.cN)r   setattrsyssplitr   	switchdirparentr   ZrglobZis_fileZname)capfdr*   monkeypatchipathZitemZ	gen_paths   &&&   r
   test_gh22819_clir;      s     EV}UG%<%B%B%DE		%	%	+0<<+=+=c+BU+B4llnYTYY+B	UY...$I555*i777#y000 
&	%U 
&	%	%s$   (C&C! C!0&C&!C&&C7	c           	     s   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        P                  ! \        RR7      ;_uu_ 4        \        4        RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z6Only one .pyf file allowed
gh-22819
CLI :: .pyf files
r0   r1   z
 hello.pyfzOnly one .pyf file per call)ZmatchN)r   r2   r3   r4   r   r5   r6   r   raisesZ
ValueErrorr   )r7   r*   r8   r9   s   &&& r
   test_gh22819_many_pyfr=      s}    
 EV}UG:%F%L%L%NO		%	%]]:-JKKI L 
&	%KK 
&	%	%s$   %B2B	B2B/*B22C	c                 sp   \        VR R7      pVP                  pVP                  \        RRV R2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        VP                  P                  4       pRV9  g   Q h RRR4       R#   + '       g   i     R# ; i)testr   r0   f2py z -m testzintproductf2pywrap, intprN)r   r   r2   r3   r4   r   r5   r6   r   r   r    )r7   r)   r8   foutlr9   Zwrapperr:   r
   test_gh23598_warnrB      s    V4ELLEV
wh%%') 
	%	%	,,((**'999 
&	%	%	%s   +.B$$B5	c                s   \        V4      p\        V4      P                  R,           pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9   g   Q h\        V 4      P                  4       '       g   Q h RRR4       R#   + '       g   i     R# ; i)zAEnsures that a signature file is generated via the CLI
CLI :: -h
r   r0   zf2py -h  Saving signatures to fileN)r   Zstemr2   r3   r4   r   r5   r6   r   
readouterrexists)r7   r'   r8   r9   Zopathout_   &&&    r
   test_gen_pyfrJ      s     !E!&&/EVxwaw%?%E%E%GH		%	%	!!#*c111ug&&((((	 
&	%	%	%s   ;ACC	c                sT   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERV9   g   Q hRV9   g   Q h RRR4       R#   + '       g   i     R# ; i)z@Ensures that a signature file can be dumped to stdout
CLI :: -h
r0   zf2py -h stdout rD   zfunction hi() ! in N	r   r2   r3   r4   r   r5   r6   r   rE   r7   r'   r8   r9   rG   rH   r:   r
   test_gen_pyf_stdoutrM      s     !EVug%>%D%D%FG		%	%	!!#*c111$+++	 
&	%	%	%s   /BB'	c           	     s   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        R4      P                  RRR7       \        P                  ! \        4      ;_uu_ 4        \        4        V P                  4       w  rERV9   g   Q h RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zbEnsures that the CLI refuses to overwrite signature files
CLI :: -h without --overwrite-signature
r0   f2py -h faker.pyf 	faker.pyf	Fake newsr   r   z&Use --overwrite-signature to overwriteN)r   r2   r3   r4   r   r5   r6   r!   r   r<   
SystemExitr   rE   )r7   r'   r8   r9   rH   errr:   r
   test_gen_pyf_no_overwriterS      s     !EV'9%%A%G%G%IJ		%	%[$$[7$C]]:&&I%%'FA;sBBB ' 
&	%&& 
&	%	%s$   ?C'&C	C'C$C''C8	zPython 3.12 required)Zreasonc                sB   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERV9   g   Q h RRR4       R#   + '       g   i     R# ; i)z8Check that modules are named correctly

CLI :: defaults
r0   zf2py --backend meson -c zuntitledmodule.cN)	r   r2   r3   r4   r   r5   r6   r   rE   rL   r:   r
   test_untitled_clirT      sw     !EV'?w%G%M%M%OP		%	% !!#!S((( 
&	%	%	%s   &BB	ZLinuxzCompiler and 3.12 requiredc           	     s   Rp\        WR7      pVP                  pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgRV9   g   Q h RRR4       VP                  \        RRR	.4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgR
V9   g   Q h RRR4       RpVP                  \        RRV RV R2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgRV9   g   Q h RRR4       R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)ziCheck that no distutils imports are performed on 3.12
CLI :: --fcompiler --help-link --backend distutils
hir?   r0   r@   z -c --fcompiler=gfortran -m z%--fcompiler cannot be used with mesonNf2pyz--help-linkzUse --dep for meson buildsZhi2z -c -m z --backend distutilsz.Cannot use distutils backend with Python>=3.12)r   r   r2   r3   r4   r   r5   r6   r   rE   r   )r7   r'   r8   MNAMErA   r9   rG   rH      &&&     r
   !test_no_py312_distutils_fcompilerrY      su   
 E6ELLEVuUG#?wGMMO 
	%	% !!#6#=== 
& Vfm, 
	%	%	!!#+s222 
& EVuUG75'1EFLLN 
	%	%	!!#?3FFF 
&	% 
&	%	% 
&	% 
&	%	%s$   .&F&F(#&F;F%	(F8	;G	c                s   \        VRR7      pVP                  pRpRpVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP	                  4        F  p	RV	 R	2V9   d   K  Q h	  VP	                  4        F  p
R
V
 R2V9   d   K  Q h	  RRR4       R#   + '       g   i     R# ; i)z1Tests that functions can be skipped
CLI :: skip:
r>   r?   t0 t4 t8 sd s8 s4td s0r0   r@   z -m test skip: z=buildmodule: Could not found the body of interfaced routine "". Skipping.Constructing wrapper function ""N
r   r   r2   r3   r4   r   r5   r6   r   rE   )r7   r-   r8   rA   r9   toskipZ	remainingrG   rR   skeyrkey   &&&        r
   test_f2py_skiprd     s    
 F3EJJE FIV
wofX.4468 
	%	%	##%LLNDOPTvUab # OO%D4TF!<CCC & 
&	%	%	%   18C .C C  C1	c                s   \        VRR7      pVP                  pRpRpVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP	                  4        F  p	RV	 R	2V9   d   K  Q h	  VP	                  4        F  p
R
V
 R2V9   d   K  Q h	  RRR4       R#   + '       g   i     R# ; i)z6Test that functions can be kept by only:
CLI :: only:
r>   r?   rZ   r[   r0   r@   z -m test only: <buildmodule: Could not find the body of interfaced routine "r\   r]   r^   Nr_   )r7   r-   r8   rA   r9   r`   tokeeprG   rR   ra   rb   rc   r
   test_f2py_onlyrh   $  s     F3EJJE FFV
wofX.4468 
	%	%	##%LLNDNtfT`a # LLND4TF!<CCC # 
&	%	%	%re   c                s   \        VRR7      pVP                  pRp\        V4      pRpRp	VP                  \        RRV RV	 R	V R
V 2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVP                  4        F  pRV R2V9   d   K  Q h	  VP                  4        F  pRV R2V
9   d   K  Q h	  RRR4       R#   + '       g   i     R# ; i)zZTests that it is possible to return to file processing mode
CLI :: :
BUG: numpy-gh #20520
r>   r?   rZ   ztd s0 hiblahr0   r@    -m z only: z : rf   r\   r]   r^   N)r   r   r   r2   r3   r4   r   r5   r6   r   rE   )r7   r'   r-   r8   rA   r9   r`   Zipath2rg   r   rG   rR   ra   rb   s   &&&&          r
   test_file_processing_switchrk   ;  s     F3EJJE F/"FFE
wd5'F8<BB 	
 
	%	%	##%LLNDNtfT`a # LLND4TF!<CCC # 
&	%	%	%s   8C3C3%C33D	c                s   Rp\        WR7      pVP                  pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        RRR4       \        P                  ! VP                  4      '       g   Q h\        P                  ! VP                  4      '       g   Q hR#   + '       g   i     Lb; i)z@Checks the generation of files based on a module name
CLI :: -m
rU   r?   r0   r@   rj   N)r   r   r2   r3   r4   r   r5   r6   r   r   rF   r   r   )r7   r'   r8   rW   rA   r9   r:   r
   test_mod_gen_f77rl   Y  s     E6ELLEVuUG4w%?%E%E%GH		%	%	 
& ;;u{{####;;u||$$$$ 
&	%s   .CC#	c           	     s   Rp\        WR7      pVP                  pVP                  \        RRV RV R2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        \        R4      P                  4       ;_uu_ 4       pVP                  4       pRV9   g   Q h R	R	R	4       R	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)
zuCheck that pyf files are correctly generated with module structure
CLI :: -m <name> -h pyf_file
BUG: numpy-gh #20520
rU   r?   r0   r@   rj   z
 -h hi.pyfzhi.pyfzpython module hiN)r   r   r2   r3   r4   r   r5   r6   r   r   openread)r7   r,   r8   rW   rA   r9   ZhipyfZpyfdatrX   r
   test_mod_gen_gh25263ro   j  s    
 E6EJJEVuUG4wj%I%O%O%QR		%	%	(^  ""eZZ\F%/// # 
&	%"" 
&	%	%s$   /,CC	6CCCC,	c                sb   \        VRR7      pVP                  p\        P                  ! R4      p\        P                  ! R4      pVP	                  \
        RRV R2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP                  V4      f   Q hVP                  V4      e   Q h RRR4       VP	                  \
        RRV R	2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP                  V4      e   Q hVP                  V4      f   Q h RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
z@Lowers cases by flag or when -h is present

CLI :: --[no-]lower
r>   r?   zHI\(\)zhi\(\)r0   r@   z -m test --lowerNz -m test --no-lower)r   r   recompiler2   r3   r4   r   r5   r6   r   rE   search	r7   r,   r8   rA   r9   ZcapshiZcapslorG   rH   	   &&&      r
   test_lower_cmodru   z  sK   
 7EJJEZZ	"FZZ	"FVuUG3C%D%J%J%LM		%	%	!!#}}S!---}}S!)))	 
& Vw&9:@@BD		%	%	!!#}}S!)))}}S!---	 
&	% 
&	% 
&	%	%s   AF
8AF
F	F.	c           	     s   \        VRR7      pVP                  p\        P                  ! R4      p\        P                  ! R4      pVP	                  \
        RRV RVP                   R2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP                  V4      f   Q hVP                  V4      e   Q h R	R	R	4       VP	                  \
        RRV RVP                   R
2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP                  V4      e   Q hVP                  V4      f   Q h R	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)zVLowers cases in signature files by flag or when -h is present

CLI :: --[no-]lower -h
r>   r?   z	Block: HIz	Block: hir0   r@   z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r   r   rp   rq   r2   r3   r   r4   r   r5   r6   r   rE   rr   rs   rt   r
   test_lower_sigrv     si   
 7EJJEZZ%FZZ%F 
wd599+%CDJJL 
	%	%	!!#}}S!---}}S!)))	 
& 
wd599+%NO		 
	%	%	!!#}}S!)))}}S!---	 
&	% 
&	% 
&	%	%s   $AF$AF7$F4	7G	c           
     s^   \        V4      pRpRpVP                  \        RRV RV RV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgRV R2V9   g   Q h R	R	R	4       R	#   + '       g   i     R	# ; i)
zFEnsures that the build directory can be specified

CLI :: --build-dir
ri   Ztttmpr0   f2py -m rC   z --build-dir zWrote C/API module "r^   NrK   )r7   r'   r8   r9   r   ZodirrG   rH   rX   r
   test_build_dirrx     s    
 !EEDV"5'5'tfEKKMO 
	%	%	!!#&ugR0C777 
&	%	%	%s   &*BB,	c                s|   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        R4      P                  RRR7       \        4        V P                  4       w  rERV9   g   Q h R	R	R	4       R	#   + '       g   i     R	# ; i)
zPEnsures that the build directory can be specified

CLI :: --overwrite-signature
r0   rN   z --overwrite-signaturerO   rP   r   r   rD   N)
r   r2   r3   r4   r   r5   r6   r!   r   rE   rL   r:   r
   test_overwritery     s    
 !EV
UG#9:@@BD 
	%	%[$$[7$C	!!#*c111	 
&	%	%	%s   AB**B;	c           	     s   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9   g   Q h\        V R24      P                  4       ;_uu_ 4       pRVP                  4       9   g   Q h R	R	R	4       R	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)
zBEnsures that TeX documentation is written out

CLI :: --latex-doc
ri   r0   rw   rC   z --latex-docDocumentation is saved to file
module.tex\documentclassNr   r2   r3   r4   r   r5   r6   r   rE   rm   rn   r7   r'   r8   r9   r   rG   rH   ZotexrX   r
   test_latexdocr     s    
 !EEV"5'5'>DDFH 
	%	%	!!#/3666UG:&',,..$$		333 /	 
&	% /.	 
&	%	%s%   "A
C*,C	C*C'"C**C;	c           	     N   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9  g   Q h RRR4       R#   + '       g   i     R# ; i)zEEnsures that TeX documentation is written out

CLI :: --no-latex-doc
ri   r0   rw   rC   z --no-latex-docrz   NrK   r7   r'   r8   r9   r   rG   rH   rI   r
   test_nolatexdocr     s    
 !EEV"5'5'AGGIK 
	%	%	!!#/s::: 
&	%	%	%   "&BB$	c           	     s   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9   g   Q h\        RV R24      P                  4       ;_uu_ 4       pR	VP                  4       9  g   Q h R
R
R
4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     R
# ; i)zEnsures that truncated documentation is written out

TODO: Test to ensure this has no effect without --latex-doc
CLI :: --latex-doc --short-latex
ri   r0   rw   rC   z --latex-doc --short-latexrz   ./r{   r|   Nr}   r~   rX   r
   test_shortlatexr     s     !EE
5'5'!;<BBD 
	%	%	!!#/3666BugZ()..00D$DIIK777 1	 
&	% 10	 
&	%	%%   "AC+-C	C+C(#C++C<	c           	     s   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9   g   Q h\        RV R24      P                  4       ;_uu_ 4       pR	VP                  4       9   g   Q h R
R
R
4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     R
# ; i)zAEnsures that RsT documentation is written out

CLI :: --rest-doc
ri   r0   rw   rC   z --rest-doc#ReST Documentation is saved to filer   zmodule.restz.. -*- rest -*-Nr}   )r7   r'   r8   r9   r   rG   rH   ZorstrX   r
   test_restdocr     s    
 !EEV"5'5'=CCEG 
	%	%	!!#4;;;Bug[)*//11T%444 2	 
&	% 21	 
&	%	%r   c           	     r   )zDEnsures that TeX documentation is written out

CLI :: --no-rest-doc
ri   r0   rw   rC   z --no-rest-docr   NrK   r   rI   r
   test_norestexdocr   '  s    
 !EEV"5'5'@FFHJ 
	%	%	!!#4C??? 
&	%	%	%r   c           	     s   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        RV R24      P                  4       ;_uu_ 4       pRVP                  4       9   g   Q h R	R	R	4       R	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)
zAEnsures that debugging wrappers are written

CLI :: --debug-capi
ri   r0   rw   rC   z --debug-capir   r   z#define DEBUGCFUNCSN
r   r2   r3   r4   r   r5   r6   r   rm   rn   )r7   r'   r8   r9   r   ocmodr:   r
   test_debugcapir   7  s    
 !EEV"5'5'?EEGI 
	%	%	BugX&',,..%)UZZ\999 / 
&	%.. 
&	%	%s$   "0CB=	+C=CCC!	z2Consistently fails on CI; noisy so skip not xfail.c           	     s   \        V 4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                  ! \        P                   R24      p\        P                  ! VRRR	7      pR
p\        P                  ! R4      pVP                  V8X  g   Q hVP                  V8X  g   Q h RRR4       R#   + '       g   i     R# ; i)z=Ensures that debugging wrappers work

CLI :: --debug-capi -c
ri   r0   rw   rC   z -c --debug-capi -c "import blah; blah.hi()"TUTF-8Zcapture_outputr    Hello World
a   debug-capi:Python C/API function blah.hi()
debug-capi:float hi=:output,hidden,scalar
debug-capi:hi=0
debug-capi:Fortran subroutine `f2pywraphi(&hi)'
debug-capi:hi=0
debug-capi:Building return value.
debug-capi:Python C/API function blah.hi: successful.
debug-capi:Freeing memory.
        N)r   r2   r3   r4   r   r5   r6   r   shlex
executable
subprocessruntextwrapZdedentstdoutstderr)r'   r8   r9   r   cmd_runrouteoutZeerrs   &&      r
   test_debugcapi_bldr   G  s     !EEV"5'5'1ABHHJL 
	%	%	++ 00NOP~~gdWM 	  	 {{d"""{{d"""! 
&	%	%	%s   "B	C66D	c           	     sv   \        V4      pRpVP                  \        RRV RV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        RRR4       V P                  4       w  rVRV9   g   Q hVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRV9   g   Q h RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zgEnsures that fortran subroutine wrappers for F77 are included by default

CLI :: --[no]-wrap-functions
ri   r0   rw   rC   N Fortran 77 wrappers are saved toz --wrap-functionsrK   r   rI   r
   test_wrapfunc_defr   e  s     !EEVxwaw%?%E%E%GH		%	%	 
&FC.#555 V"5'5'1BCIIKM 
	%	%	!!#2c999 
&	% 
&	% 
&	%	%s   !D#&D'D$	'D8	c           	     r   )z]Ensures that fortran subroutine wrappers for F77 can be disabled

CLI :: --no-wrap-functions
ri   r0   rw   rC   z --no-wrap-functionsr   NrK   r   rI   r
   test_nowrapfuncr   ~  s    
 !EEV"5'5'1EFLLNP 
	%	%	!!#2#=== 
&	%	%	%r   c           	     s   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        RV R24      P                  4       ;_uu_ 4       pVP                  4       pRV9   g   Q hR	V9   g   Q h R
R
R
4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     R
# ; i)zWAdd to the include directories

CLI :: -include
TODO: Document this in the help string
ri   r0   rw   rC   z' -include<stdbool.h> -include<stdio.h> r   r   z#include <stdbool.h>z#include <stdio.h>Nr   )r7   r'   r8   r9   r   r   ZocmrrI   r
   test_inclheaderr     s     !EE
5'5'!HI	 
	%	%	BugX&',,..%::<D)T111'4/// / 
&	%.. 
&	%	%s$   "0C#C	6CCCC,	c                     R# )z7Add to the include directories

CLI :: --include-paths
Nr   r   r	   r
   test_inclpathr          	r	   c                 r   )z3Add to the include directories

CLI :: --help-link
Nr   r   r	   r
   
test_hlinkr     r   r	   c                s   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERV9   g   Q hRV9   g   Q hRV9   g   Q hRV9   g   Q hRV9   g   Q h R	R	R	4       R	#   + '       g   i     R	# ; i)
zGCheck that Fortran-to-Python KIND specs can be passed

CLI :: --f2cmap
r0   r1   z --f2cmap mapfilez!Reading f2cmap from 'mapfile' ...z&Mapping "real(kind=real32)" to "float"z'Mapping "real(kind=real64)" to "double"z,Mapping "integer(kind=int64)" to "long_long"z0Successfully applied user defined f2cmap changesNrK   )r7   r/   r8   r9   rG   rH   r:   r
   test_f2cmapr     s    
 EV}UG;L%M%S%S%UV		%	%	!!#2c999;sBBB<CCCASHHHASHHH 
&	%	%	%s   A
B22C	c                sV   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rE\        V4      ^ 8X  g   Q h RRR4       R#   + '       g   i     R# ; i)z!Reduce verbosity

CLI :: --quiet
r0   r1   z --quietN)
r   r2   r3   r4   r   r5   r6   r   rE   ZlenrL   r:   r
   
test_quietr     sy    
 !EV}UG8%D%J%J%LM		%	%	!!#3x1}} 
&	%	%	%s   /BB(	c                sD   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERV9   g   Q h RRR4       R#   + '       g   i     R# ; i)z%Increase verbosity

CLI :: --verbose
r0   r1   z
 --verboseZanalyzelineNrK   rL   r:   r
   test_verboser     sw    
 !EV}UG:%F%L%L%NO		%	%	!!#### 
&	%	%	%s   &BB	c                s:   VP                  \        RRR.4       \        P                  ! \        4      ;_uu_ 4        \        4        V P                  4       w  r#^ RIpVP                  VP                  4       8X  g   Q h RRR4       R#   + '       g   i     R# ; i)zEnsure version

CLI :: -v
r0   rV   z-vN)
r2   r3   r   r<   rQ   r   rE   ZnumpyZ__version__Zstrip)r7   r8   rG   rH   Znps   &&   r
   test_versionr     sh    
 Vfd^4	z	"	"	!!#~~,,,	 
#	"	"	"s   AB		B	c                s   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                  ! \        P                   R24      p\        P                  ! VRRR7      pRpVP                  V8X  g   Q h R	R	R	4       R	#   + '       g   i     R	# ; i)
z
CLI :: -c
r0   r1   z -cr   Tr   r   r   N)r   r2   r3   r4   r   r5   r6   r   r   r   r   r   r   )r'   r8   r9   r   r   r   s   &&    r
   test_npdistopr     s    
 !EV}UG3%?%E%E%GH		%	%	++ 00NOP~~gdWM{{d""" 
&	%	%	%s   A CC	z*Compiler and Python 3.12 or newer requiredc                s^   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                   R2p\        '       d   VR,          pM	VR,          p\        P                  ! V4      p\        P                  ! VRRR	7      pR
pVP                  V8X  g   Q h\        '       d   RVP                  9   g   Q hVP                  ^ 8X  g   Q h RRR4       R#   + '       g   i     R# ; i)z&
CLI :: --no-freethreading-compatible
r0   r1   z! -c --no-freethreading-compatible -c "import blah; blah.hi();z1import sys; assert sys._is_gil_enabled() is True"r^   Tr   r   r   zHThe global interpreter lock (GIL) has been enabled to load module 'blah'Nr   r2   r3   r4   r   r5   r6   r   r   r   r   r   r   r   r   Z
returncoder'   r8   r9   Zcmdr   r   r      &&     r
    test_no_freethreading_compatibler     s     !EV}UG;\%]%c%c%ef		%	%   =>;GGC4KC++c"~~gdWM{{d""";]aealallll!### 
&	%	%	%s   BD*&DD,	c                sF   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                   R2p\        '       d   VR,          pM	VR,          p\        P                  ! V4      p\        P                  ! VRRR	7      pR
pVP                  V8X  g   Q hVP                  R8X  g   Q hVP                  ^ 8X  g   Q h RRR4       R#   + '       g   i     R# ; i)z#
CLI :: --freethreading_compatible
r0   r1   z -c --freethreading-compatibler   z2import sys; assert sys._is_gil_enabled() is False"r^   Tr   r   r    Nr   r   r   r
   test_freethreading_compatibler     s     !EV}UG;Y%Z%`%`%bc		%	%   =>;HHC4KC++c"~~gdWM{{d"""{{b   !### 
&	%	%	%s   B'DD 	c                 r   )z
CLI :: -c --fcompiler
Nr   r   r	   r
   test_npd_fcompilerr   7      
 	r	   c                 r   )z
CLI :: -c --compiler
Nr   r   r	   r
   test_npd_compilerr   ?  r   r	   c                 r   )z
CLI :: -c --help-fcompiler
Nr   r   r	   r
   test_npd_help_fcompilerr   G  r   r	   c                 r   )z
CLI :: -c --f77exec
Nr   r   r	   r
   test_npd_f77execr   O  r   r	   c                 r   )z
CLI :: -c --f90exec
Nr   r   r	   r
   test_npd_f90execr   W  r   r	   c                 r   )z
CLI :: -c --f77flags
Nr   r   r	   r
   test_npd_f77flagsr   _  r   r	   c                 r   )z
CLI :: -c --f90flags
Nr   r   r	   r
   test_npd_f90flagsr   g  r   r	   c                 r   )z
CLI :: -c --opt
Nr   r   r	   r
   test_npd_optr   o  r   r	   c                 r   )z
CLI :: -c --arch
Nr   r   r	   r
   test_npd_archr   w  r   r	   c                 r   )z
CLI :: -c --noopt
Nr   r   r	   r
   test_npd_nooptr     r   r	   c                 r   )z
CLI :: -c --noarch
Nr   r   r	   r
   test_npd_noarchr     r   r	   c                 r   )z
CLI :: -c --debug
Nr   r   r	   r
   test_npd_debugr     r   r	   c                 r   )z
CLI :: -c --link-<resource>
Nr   r   r	   r
   test_npd_link_autor     r   r	   c                 r   )z'
CLI :: -c -L/path/to/lib/ -l<libname>
Nr   r   r	   r
   test_npd_libr     r   r	   c                 r   )z
CLI :: -D<define>
Nr   r   r	   r
   test_npd_definer     r   r	   c                 r   )z
CLI :: -U<name>
Nr   r   r	   r
   test_npd_undefiner     r   r	   c                 r   )z
CLI :: -I/path/to/include/
Nr   r   r	   r
   test_npd_inclr     r   r	   c                 r   )z0
CLI :: <filename>.o <filename>.so <filename>.a
Nr   r   r	   r
   test_npd_linkerr     r   r	   )Zuntitled)i   i   )XZplatformrp   r   r   r3   r   Zcollectionsr    Zpathlibr   r   Znumpy.f2py.f2py2er   r   Znumpy.testing._private.utilsr   r   r   r   r   r   Zfixturer'   r)   r*   r,   r-   r/   r;   r=   rB   rJ   rM   rS   ZmarkZskipifZversion_inforT   ZsystemrY   Zxfailrd   rh   rk   rl   ro   ru   rv   rx   ry   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   r   r   r   r   r	   r
   <module>r      sn    	   
  "   - 4  
HH	IN i  ! i  ! i  ! i  ! i  ! i  !1&	
:)
,C C$$/8NO
) P
) X__&'1SSs7G7G77R\xyG zG> D D.D.D<%"0 .4$.N8"2"4$; 8,5$@ :  MN# O#::2> 0.		I$$- MN# O# X__&'1QQc6F6F'6QG  I$I$. X__&'1QQc6F6F'6QG  I$I$2																		r	   