
    hi                    h    d Z ddlmZ ddlZddlZddlZddlZddlmZ  G d dej	                  Z
dS )zPTest that C functions used in primitives are declared in a header such as CPy.h.    )annotationsN)registryc                      e Zd ZddZdS )TestHeaderInclusionreturnNonec                   t           j                            t           j                            t                    dd          }t          t           j                            |d                    5 }|                                d d d            n# 1 swxY w Y   t          t           j                            |d                    5 }|                                z  d d d            n# 1 swxY w Y   dfd	}t          j        	                                t          j
        	                                t          j        	                                t          j        	                                fD ]#}|D ]}|D ]}|j         ||j                   $t           j                            t           j                            t                    dd
          }t          j        | d          D ]`}t          |          5 }|                                }	d d d            n# 1 swxY w Y   t          j        d|	          D ]}
 ||
           ad S )Nz..zlib-rtzCPy.hzpythonsupport.hnamestrr   r   c                    |                      d          r't          j        d|  d          sJ d|  d            d S d S )NCPyz\b"z7" is used in mypyc.primitives but not declared in CPy.h)
startswithresearch)r
   headers    g/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/mypyc/test/test_cheader.py
check_namezJTestHeaderInclusion.test_primitives_included_in_header.<locals>.check_name   sx    u%% Uy"$NNNF  U UTtTTTU U UU UU U    
primitivesz/*.pyz'c_function_name=["\'](CPy[A-Z_a-z0-9]+))r
   r   r   r   )ospathjoindirname__file__openreadr   method_call_opsvalues
binary_ops	unary_opsfunction_opsc_function_nameglobr   findall)selfbase_dirfr   r   opsopprimitives_pathfnamcontentr
   r   s              @r   "test_primitives_included_in_headerz6TestHeaderInclusion.test_primitives_included_in_header   s   7<< 9 94JJ"',,x1122 	aVVXXF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	"',,x):;;<< 	affhhF	 	 	 	 	 	 	 	 	 	 	 	 	 	 		U 	U 	U 	U 	U 	U $++--&&((%%''!((**	
 		7 		7F  7 7 7 7B)5"
2#566677
 ',,rwx'@'@$UUI77788 	! 	!Dd #q&&((# # # # # # # # # # # # # # #
#MwWW ! !
4    !	! 	!s6   2BBBC//C36C3H&&H*	-H*	N)r   r   )__name__
__module____qualname__r.    r   r   r   r      s(        ! ! ! ! ! !r   r   )__doc__
__future__r   r$   r   r   unittestmypyc.primitivesr   TestCaser   r2   r   r   <module>r8      s    V V " " " " " "  				 				  % % % % % %! ! ! ! !(+ ! ! ! ! !r   