
     YHhS                         d dl Z d dlmZmZ d Z G d de j
                        Z G d de      Z G d d	e      Z G d
 de j
                        Z	y)    N)CodeUtilityCodec                 j    | d   xr | d   j                         | d   xr | d   j                         fS )Nr      )strip)tups    ^/var/www/html/planif/env/lib/python3.12/site-packages/Cython/Compiler/Tests/TestUtilityLoad.py
strip_2tupr
      s3    q6$c!fllnc!f&?Q??    c                   V    e Zd ZdZdZdZ ed      Zd ZdZ	e
j                  Zd Zd Zy	)
TestUtilityLoaderz#
    Test loading UtilityCodes
    )ztest {{loader}} prototypeztest {{loader}} impl)zreq {{loader}} protozreq {{loader}} implLoader)loaderzTestUtilityLoader.cc                     t        | j                  j                  | j                  | j                              }| j                  || j                         y )N)r
   clsload_as_stringnamefilenameassertEqualexpectedselfgots     r	   test_load_as_stringz%TestUtilityLoader.test_load_as_string   s9    00DMMJKdmm,r   c                 R   | j                   j                  | j                  | j                        }t	        |j
                  |j                  f      }| j                  || j                         |j                  \  }t	        |j
                  |j                  f      }| j                  || j                         | j                   j                  | j                  | j                        }t	        |j
                  |j                  f      }| j                  || j                         y )N)	from_file)r   loadr   r   r
   protoimplr   r   requiresrequiredload_cachedr   utilityr   r!   s       r	   	test_loadzTestUtilityLoader.test_load   s    ((--		T]]-C'--67dmm,$$	(..(--89dmm,((&&tyyDMM&J'--67dmm,r   N)__name__
__module____qualname____doc__r   r!   dictcontextr   r   r   r   r   r   r%    r   r	   r   r   	   s=     CH<H(#GD$H


C--r   r   c                   ,   e Zd ZdZej
                  d   j                  dd      ej
                  d   j                  dd      fZej                  d   j                  dd      ej                  d   j                  dd      fZ	e
j                  Zd Zd Zy)	TestTempitaUtilityLoaderz=
    Test loading UtilityCodes with Tempita substitution
    r   z
{{loader}}r   r   c                     t        | j                  j                  | j                  | j                  | j
                              }| j                  || j                         y )Nr+   )r
   r   r   r   r   r+   r   expected_tempitar   s     r	   r   z,TestTempitaUtilityLoader.test_load_as_string6   sG    00DMMSWS_S_0`ad334r   c                 ~   | j                   j                  | j                  | j                  | j                        }t        |j                  |j                  f      }| j                  || j                         |j                  \  }t        |j                  |j                  f      }| j                  || j                         | j                   j                  | j                  | j                  | j                        }t        |j                  |j                  f      }| j                  || j                         y )Nr0   )r   r+   )r   r   r   r   r+   r
   r   r   r   r1   r    required_tempitar#   s       r	   r%   z"TestTempitaUtilityLoader.test_load:   s    ((--		4==$,,-O'--67d334$$	(..(--89d334((--		T]]DLL-Y'--67d334r   N)r&   r'   r(   r)   r   r   replacer1   r!   r3   r   TempitaUtilityCoder   r   r%   r,   r   r	   r.   r.   *   s     *2215==lHU)2215==lHUW *2215==lHU)2215==lHUW 
!
!C55r   r.   c                       e Zd ZdZdZdZdZdZ ed      Z	dZ
d	Zej                  Zd
e_        ej"                  Zej"                  Zy
)TestCythonUtilityLoaderz)
    Test loading CythonUtilityCodes
    )Nztest {{cy_loader}} impl)Nztest CyLoader impl)Nzreq {{cy_loader}} impl)Nzreq CyLoader implCyLoader)	cy_loaderTestCyUtilityLoaderzTestCyUtilityLoader.pyxN)r&   r'   r(   r)   r   r1   r!   r3   r*   r+   r   r   r   CythonUtilityCoder   r   r   r%   r.   test_load_tempitar,   r   r	   r7   r7   H   s^    
 /H1-H0Z(G D(H

'
'C CI!++I0::r   r7   c                       e Zd Zd Zy)TestUtilityCodec                 d   t         j                  j                  dd      }t         j                  j                  dd      }t         j                  j                  dd      }t         j                  j                  dd      }t         j                  j                  dd      }t         j                  j                  dd      }||||||g}t        t	        |            D ]Q  }t        t	        |            D ]8  }	|	|k(  r| j                  ||   ||	          !| j                  ||   ||	          : S y )	NNumpyImportUFunczNumpyImportArray.cNumpyImportArraypyunicode_strlenzStringTools.cpyunicode_from_unicodeIncludeStringHIncludeCppStringH)r   r   r   rangelenr   assertNotEqual)
r   c1c2c3c4c5c6codesmns
             r	   test_equalityzTestUtilityCode.test_equalityb   s   ""#57KL""#57KL""#5G""#;_M""#3_E""#6HRRR(s5z" 	<A3u:& <6$$U1XuQx8''a%(;	<	<r   N)r&   r'   r(   rR   r,   r   r	   r>   r>   a   s    <r   r>   )
unittestCython.Compilerr   r   r
   TestCaser   r.   r7   r>   r,   r   r	   <module>rV      sP     -@-)) -B50 5<;6 ;2<h'' <r   