o
    ðT·jÙ  ã                   @   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é   ©Údtypeé   é   )r   r   r   )	ÚnpÚarangeÚfloat32ÚpytestÚraisesÚ
ValueErrorÚmoduleÚfooÚallclose)ÚselfÚx© r   úc/home/dinkstrade/pdmp-scanner/venv/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 )Néd   iñ  é   iö  )r   ÚdatonlyÚ	max_valueÚdatÚmax_Úsimple_subroutine)r   Ú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   Ú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   )ÚxlÚxhr   r   r   Úubound2   s   z0TestNegativeBounds.test_negbound.<locals>.ubound)Úis_Úie_Úarré   r   )r   r   r   r   r   r   )r   ÚxvecÚxlowÚxhighr5   ÚrvalÚ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   Ú
isinstancerA   Ú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#   rG   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   Úf2pyÚget_includeÚosÚlistdir)ÚincdirÚfnames_in_dirÚfnamer   r   r   Útest_include_pathL   s
   

ÿrP   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   ÚexpÚresr   r   r   Útest_gh25344X   s   zTestIncludeFiles.test_gh25344N)r   r   r   r   r    r!   Úoptionsr   r"   r#   rU   r   r   r   r   rQ   S   s    ÿrQ   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   ÚarrayÚint32r   Útestsub©r   Úx1Úx2rT   r   r   r   Útest_gh26148b   ó
   zTestF77Comments.test_gh26148c                 C   s0   t jddt jd�d }| j ¡ }t ||¡ d S )Nr   r9   r   r   )r   r   r   r   Útestsub2ÚnptÚassert_allclose)r   ÚexpectedrT   r   r   r   Útest_gh26466j   s   
zTestF77Comments.test_gh26466N)r   r   r   r   r    r!   r   r"   r#   rc   ri   r   r   r   r   rW   ^   s    
rW   c                   @   r   )ÚTestF90Contiuationr   r   r   úf90continuation.f90c                 C   rX   rY   r\   r`   r   r   r   Útest_gh26148bu   rd   z TestF90Contiuation.test_gh26148bN)
r   r   r   r   r    r!   r   r"   r#   rl   r   r   r   r   rj   q   r$   rj   c                   @   r   )ÚTestLowerF2PYDirectivesr   r   r   zlower_f2py_fortran.f90c                 C   s   | j  d¡ d S )Nr   )r   Úinquire_nextrF   r   r   r   Útest_gh28014�   s   z$TestLowerF2PYDirectives.test_gh28014N)
r   r   r   r   r    r!   r   r"   r#   ro   r   r   r   r   rm   }   r$   rm   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   rk   z	-lfoo.barÚBlah)Úmodule_namezlparen got assign)r   Úbuild_moduler    ÚRuntimeErrorrD   ©ÚaaÚrerrr   r   r   Útest_gh26623†   s   ý€ÿrw   )ÚLinuxÚ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"rp   )rV   rq   Úunknown_subroutine_)r   rr   r    ÚImportErrorrD   rt   r   r   r   Útest_gh25784“   s   ýù	€ÿr}   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_globalsÚn_maxÚi_maxÚj_maxrF   r   r   r   Útest_gh27167ª   s   z&TestAssignmentOnlyModules.test_gh27167N)
r   r   r   r   r    r!   r   r"   r#   r†   r   r   r   r   r~   ¥   rH   r~   )rK   r   ÚplatformÚnumpyr   Únumpy.testingÚtestingrf   Ú r   ÚF2PyTestr   r%   r/   r@   rP   rQ   rW   rj   rm   r"   r#   rw   ÚskipifÚsystemr}   r~   r   r   r   r   Ú<module>   s,    	
