o
    f                     @   sX   d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ dd Z	G dd deZ
dS )    N)
CythonTestc                  O   s,   t j  d t jj_t jjj| i | d S N)CythonUtilsclear_function_cachesBuildDependencies	_dep_tree	cythonize)argskwargs r   ^/var/www/html/mig_web/myenv/lib/python3.10/site-packages/Cython/Build/Tests/TestRecythonize.pyfresh_cythonize   s   

r   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestRecythonizec                 C   s.   t |  tjdtjdrdnd d| _d S )Nzrecythonize-testTEST_TMPprefixdir)r   setUptempfilemkdtempospathisdirtemp_dirselfr   r   r   r      s   
zTestRecythonize.setUpc                 C   s   t |  t| j d S r   )r   tearDownshutilrmtreer   r   r   r   r   r      s   
zTestRecythonize.tearDownc           	      C     t jd| jd}tj|d}tj|d}tj|d}tjj	 }t
|d}|d W d    n1 s8w   Y  t
|d}|d W d    n1 sRw   Y  | ||h|| t| td	 t
|}| }W d    n1 s~w   Y  t
|d}|d
 W d    n1 sw   Y  t| t
|}| }W d    n1 sw   Y  | d|v  | d|v  | d|v  | d|v  d S )Nsrcr   a.pxda.pyxa.cwcdef int value

value = 1
   cdef double value
__pyx_v_1a_value = 1;__pyx_v_1a_value = 1.0;r   r   r   r   r   joinr   r   r   create_dependency_treeopenwriteassertEqualall_dependenciesr   timesleepread
assertTrueassertFalse)	r   src_dira_pxda_pyxa_cdep_treefa_c_contents1a_c_contents2r   r   r   "test_recythonize_pyx_on_pxd_change   s8   




z2TestRecythonize.test_recythonize_pyx_on_pxd_changec           	      C   r!   )Nr"   r   r#   za.pyr%   r&   r'   r(   r)   r*   r+   r,   r-   )	r   r9   r:   a_pyr<   r=   r>   r?   r@   r   r   r   !test_recythonize_py_on_pxd_changeI   s8   




z1TestRecythonize.test_recythonize_py_on_pxd_changec           
      C   s  t jd| jd}tj|d}tj|d}tj|d}tj|d}tjj	 }t
|d}|d W d    n1 s?w   Y  t
|d}|d	 W d    n1 sYw   Y  t
|d}|d
 W d    n1 ssw   Y  | ||h|| t||g td t
|}| }W d    n1 sw   Y  t
|d}|d W d    n1 sw   Y  t||g t
|}| }	W d    n1 sw   Y  | d|v  | d|	v  | d|	v  | d|v  d S )Nr"   r   r#   r$   zb.pyxb.cr&   r'   r(   zcimport a
a.value = 2
r)   r*   __pyx_v_1a_value = 2;__pyx_v_1a_value = 2.0;r-   )
r   r9   r:   r;   b_pyxb_cr=   r>   b_c_contents1b_c_contents2r   r   r   &test_recythonize_pyx_on_dep_pxd_changes   s@   




z6TestRecythonize.test_recythonize_pyx_on_dep_pxd_changec                 C   s<  t jd| jd}tj|d}tj|d}tj|d}tj|d}tj|d}tjj	 }t
|d}|d	 W d    n1 sFw   Y  t
|d}|d
 W d    n1 s`w   Y  t
|d}|d W d    n1 szw   Y  t
|d}|d W d    n1 sw   Y  | |||h|| t||g td t
|}| }	W d    n1 sw   Y  t
|d}|d W d    n1 sw   Y  t||g t
|}| }
W d    n1 sw   Y  | d|	v  | d|
v  | d|
v  | d|	v  d S )Nr"   r   r#   r$   zb.pxdzb.pyrD   r&   r'   r(   z
cimport a
za.value = 2
r)   r*   rE   rF   r-   )r   r9   r:   r;   b_pxdb_pyrH   r=   r>   rI   rJ   r   r   r   %test_recythonize_py_on_dep_pxd_change   sH   




z5TestRecythonize.test_recythonize_py_on_dep_pxd_changeN)	__name__
__module____qualname__r   r   rA   rC   rK   rN   r   r   r   r   r      s    	**1r   )r   r   r   r4   Cython.Build.Dependenciesr   Cython.UtilsCython.TestUtilsr   r   r   r   r   r   r   <module>   s    