a
    Lf                     @   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d
d 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dS )    N   )utilc                   @   s.   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   Y/var/www/ai-form-bot/venv/lib/python3.9/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      s   r   c                   @   s.   e Zd ZeddddgZejjdd Z	dS )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 ||sZJ d S )	N   i   c                 S   s   ||  d S )Nr   r   )Zxlxhr   r   r   ubound&   s    z0TestNegativeBounds.test_negbound.<locals>.ubound)is_Zie_Zarr   r
   )r   r   r   r   r   r   )r   ZxvecZxlowZxhighr%   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!      s   r!   c                   @   s.   e Zd ZeddddgZejjdd Z	dS )TestNumpyVersionAttributer   r   r   r   c                 C   s8   t | jdsJ t| jjts"J tj| jjks4J d S )N__f2py_numpy_version__)hasattrr   
isinstancer+   strr   __version__)r   r   r   r   test_numpy_version_attribute3   s    z6TestNumpyVersionAttribute.test_numpy_version_attributeN)
r   r   r   r   r   r   r   r   r    r0   r   r   r   r   r*   .   s   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)incdirZfnames_in_dirfnamer   r   r   test_include_path@   s    

r5   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_gh25344L   s    zTestIncludeFiles.test_gh25344N)r   r   r   r   r   r   optionsr   r   r    r:   r   r   r   r   r6   G   s   r6   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   sR   t jdt jd}t jdt jd}| j||}|d dks>J |d dksNJ d S Nr   r
      r      r      r   arrayZint32r   Ztestsubr   x1Zx2r9   r   r   r   test_gh26148V   s
    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   expectedr9   r   r   r   test_gh26466^   s    
zTestF77Comments.test_gh26466N)r   r   r   r   r   r   r   r   r    rE   rH   r   r   r   r   r<   R   s
   
r<   c                   @   s.   e Zd ZeddddgZejjdd Z	dS )TestF90Contiuationr   r   r   f90continuation.f90c                 C   sR   t jdt jd}t jdt jd}| j||}|d dks>J |d dksNJ d S r=   rA   rC   r   r   r   test_gh26148bi   s
    z TestF90Contiuation.test_gh26148bN)
r   r   r   r   r   r   r   r   r    rK   r   r   r   r   rI   e   s   rI   c               
   C   s^   z$t jt ddddgdgdd} W n4 tyX } zdt|vsDJ W Y d }~n
d }~0 0 d S )	Nr   r   r   rJ   z	-lfoo.barBlah)module_namezlparen got assign)r   build_moduler   RuntimeErrorr.   ZaaZrerrr   r   r   test_gh26623q   s    
rQ   )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 n4 tyZ } zd	t|v sFJ W Y d }~n
d }~0 0 d S )
Nr   r   r   zf77fixedform.f95z--f77flags='-ffixed-form -O2'z--f90flags="-ffixed-form -Og"rL   )r;   rM   Zunknown_subroutine_)r   rN   r   ImportErrorr.   rP   r   r   r   test_gh25784~   s    
	rV   )r1   r   platformnumpyr   Znumpy.testingZtestingrF    r   ZF2PyTestr   r!   r*   r5   r6   r<   rI   r   r    rQ   ZskipifsystemrV   r   r   r   r   <module>   s"   
