o
    k)h                     @   s&  d dl Z d dlZd dlZd dlZd dlmZ ddlm	Z	 G dd de	j
ZG dd de	j
ZG dd	 d	e	j
ZG d
d de	j
Zdd ZG dd de	j
ZG dd de	j
ZG dd de	j
ZG dd de	j
Zejjdd Zejjejje dvdddd ZejjG dd de	j
ZdS )    N   )utilc                   @   .   e Zd ZeddddgZejjdd Z	dS )TestIntentInOuttestssrc
regression	inout.f90c                 C   s`   t jdt jdd d d }tt| jj| t jdt jd}| j| t |g ds.J d S )N   Zdtype      )r   r   r   )	nparangefloat32pytestZraises
ValueErrormodulefooallclose)selfx r   @lib/python3.10/site-packages/numpy/f2py/tests/test_regression.py
test_inout   s
   zTestIntentInOut.test_inoutN)
__name__
__module____qualname__r   getpathsourcesr   markslowr   r   r   r   r   r          r   c                   @   r   )TestDataOnlyMultiModuler   r   r   zdatonly.f90c                 C   s@   | j jjdks	J | j jjdksJ d}| j ddksJ d S )Nd   i     i  )r   ZdatonlyZ	max_valueZdatZmax_Zsimple_subroutine)r   Zint_inr   r   r   	test_mdat   s   z!TestDataOnlyMultiModule.test_mdatN)
r   r   r   r   r   r   r   r    r!   r&   r   r   r   r   r#      r"   r#   c                   @   r   )TestNegativeBoundsr   r   Znegative_boundszissue_20853.f90c                 C   s^   t d}d}d}dd }| jj|||d ||| d}t jdt jd}t ||s-J d S )	N   i   c                 S   s   ||  d S )Nr   r   )Zxlxhr   r   r   ubound2   s   z0TestNegativeBounds.test_negbound.<locals>.ubound)is_Zie_Zarr   r   )r   r   r   r   r   r   )r   ZxvecZxlowZxhighr+   ZrvalZexpvalr   r   r   test_negbound+   s   

z TestNegativeBounds.test_negboundN)
r   r   r   r   r   r   r   r    r!   r.   r   r   r   r   r'   '   r"   r'   c                   @   r   )TestNumpyVersionAttributer   r   r   r	   c                 C   s8   t | jdsJ t| jjtsJ tj| jjksJ d S )N__f2py_numpy_version__)hasattrr   
isinstancer0   strr   __version__r   r   r   r   test_numpy_version_attribute?   s   z6TestNumpyVersionAttribute.test_numpy_version_attributeN)
r   r   r   r   r   r   r   r    r!   r6   r   r   r   r   r/   :       r/   c                  C   s.   t j } t| }dD ]}||v sJ qd S )N)zfortranobject.czfortranobject.h)r   Zf2pyZget_includeoslistdir)ZincdirZfnames_in_dirfnamer   r   r   test_include_pathL   s
   

r;   c                   @   sV   e Zd ZeddddgZdeddd deddd gZejj	dd Z
d	S )
TestIncludeFilesr   r   r   zincfile.f90z-Iz--include-paths c                 C   s"   d}| j dd}||ksJ d S )Ng      @g      @g      @)r   add)r   Zexpresr   r   r   test_gh25344X   s   zTestIncludeFiles.test_gh25344N)r   r   r   r   r   r   optionsr   r    r!   r?   r   r   r   r   r<   S   s    r<   c                   @   s>   e Zd ZeddddgZejjdd Z	ejjdd Z
d	S )
TestF77Commentsr   r   r   zf77comments.fc                 C   R   t jdt jd}t jdt jd}| j||}|d dksJ |d dks'J d S Nr   r   r%   r      r      r   ZarrayZint32r   Ztestsubr   Zx1Zx2r>   r   r   r   test_gh26148b   
   zTestF77Comments.test_gh26148c                 C   s0   t jddt jdd }| j }t|| d S )Nr   r-   r   r   )r   r   r   r   Ztestsub2nptZassert_allclose)r   Zexpectedr>   r   r   r   test_gh26466j   s   
zTestF77Comments.test_gh26466N)r   r   r   r   r   r   r   r    r!   rH   rK   r   r   r   r   rA   ^   s    
rA   c                   @   r   )TestF90Contiuationr   r   r   f90continuation.f90c                 C   rB   rC   rF   rG   r   r   r   test_gh26148bu   rI   z TestF90Contiuation.test_gh26148bN)
r   r   r   r   r   r   r   r    r!   rN   r   r   r   r   rL   q   r"   rL   c                   @   r   )TestLowerF2PYDirectivesr   r   r   zlower_f2py_fortran.f90c                 C   s   | j d d S )Nr   )r   Zinquire_nextr5   r   r   r   test_gh28014   s   z$TestLowerF2PYDirectives.test_gh28014N)
r   r   r   r   r   r   r   r    r!   rP   r   r   r   r   rO   }   r"   rO   c               
   C   s^   zt jt ddddgdgdd} W d S  ty. } zdt|vs#J W Y d }~d S d }~ww )	Nr   r   r   rM   z	-lfoo.barBlah)module_namezlparen got assign)r   build_moduler   RuntimeErrorr3   ZaaZrerrr   r   r   test_gh26623   s   rV   )ZLinuxZDarwinz$Unsupported on this platform for now)reasonc               
   C   s`   zt jt ddddgddgdd} W d S  ty/ } zd	t|v s$J W Y d }~d S d }~ww )
Nr   r   r   zf77fixedform.f95z--f77flags='-ffixed-form -O2'z--f90flags="-ffixed-form -Og"rQ   )r@   rR   Zunknown_subroutine_)r   rS   r   ImportErrorr3   rU   r   r   r   test_gh25784   s   	rY   c                   @   r   )TestAssignmentOnlyModulesr   r   r   zassignOnlyModule.f90c                 C   s:   | j jjdks	J | j jjdksJ | j jjdksJ d S )N      H   )r   	f_globalsZn_maxZi_maxZj_maxr5   r   r   r   test_gh27167   s   z&TestAssignmentOnlyModules.test_gh27167N)
r   r   r   r   r   r   r   r    r!   r_   r   r   r   r   rZ      r7   rZ   )r8   r   platformZnumpyr   Znumpy.testingZtestingrJ    r   ZF2PyTestr   r#   r'   r/   r;   r<   rA   rL   rO   r    r!   rV   ZskipifsystemrY   rZ   r   r   r   r   <module>   s,    	
