o
    i                  
   @   s   d dl Z d dlZd dlmZmZmZ d dlZd dlmZ d dl	m
Z d dlmZ ddddd	d
dddd	Zg dZdd Zdd Zdd Zejjedddd Zdd Zdd Zdd Zd d! Zd"d# ZdS )$    N)assert_assert_equalIS_PYPY)raises)_sf_error_test_function                        	   )	singular	underflowoverflowslowloss	no_resultdomainargother)ignorewarnraisec                 C   s   |dkr!t tj | |  W d    d S 1 sw   Y  d S |dkrAttj | |  W d    d S 1 s:w   Y  d S t  td | |  W d    d S 1 sZw   Y  d S )Nr   r   error)	pytestwarnsscSpecialFunctionWarningassert_raisesSpecialFunctionErrorwarningscatch_warningssimplefilter)funargsaction r)   \/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/scipy/special/tests/test_sf_error.py_check_action   s   
"
"


"r+   c                  C   s6   t  } |  D ]\}}t|tv  t|tv  qd S )N)r   geterritemsr   _sf_error_code_map_sf_error_actions)errkeyvaluer)   r)   r*   test_geterr-   s
   r3   c               
   C   s   t  } zPt D ]@\}}tD ]9}t  }t jdi ||i}t||k t  }t|| |k || || t||k tt	|f| qq	W t jdi |  d S t jdi |  w Nr)   )
r   r,   r.   r-   r/   seterrr   popr+   r   )	entry_errcategory
error_coder(   geterr_olderrseterr_olderrnewerrr)   r)   r*   test_seterr4   s    

&r=   zTest not meaningful on PyPy)reasonc               	   C   s   t t} tjdd% tjtjdd td W d    n1 s$w   Y  W d    n1 s3w   Y  t t}|| ksCJ d S )Nr   )allzdomain error)matchg       @)sysgetrefcountr   errstater   r   r"   ndtri)refcount_beforerefcount_afterr)   r)   r*   test_sf_error_special_refcountF   s   

rG   c               	   C   z   t  } t jdd" tt j t d W d    n1 s w   Y  W d    n1 s/w   Y  t| t   d S )Nr   )r   r   )r   r,   rC   r!   r"   loggammar   olderrr)   r)   r*   test_errstate_pyx_basicS      rL   c               	   C   rH   )Nr   )r   )r   r,   rC   r!   r"   spencer   rJ   r)   r)   r*   test_errstate_c_basic[   rM   rP   c               	   C   rH   )Nr   )r   i)r   r,   rC   r!   r"   wrightomegar   rJ   r)   r)   r*   test_errstate_cpp_basicc   rM   rR   c               
   C   sx   t  D ]5\} }tD ].}t }tjdi | |i tt|f| W d    n1 s,w   Y  t|t  q
qd S r4   )	r.   r-   r/   r   r,   rC   r+   r   r   )r8   r9   r(   rK   r)   r)   r*   test_errstatek   s   rS   c               	   C   s   t  } t jddd' t d tt j t d W d    n1 s&w   Y  W d    n1 s5w   Y  t| t   d S )Nr   r   )r?   r   r   g      )r   r,   rC   gammalnr!   r"   rO   r   rJ   r)   r)   r*   test_errstate_all_but_onet   s   
rU   )rA   r#   numpy.testingr   r   r   r   r   r!   scipy.specialspecialr   scipy.special._ufuncsr   r.   r/   r+   r3   r=   markskipifrG   rL   rP   rR   rS   rU   r)   r)   r)   r*   <module>   s8    
	