o
    ÕjŒ  ã                   @   sB   d dl Z d dlmZ d dlmZmZmZmZ G dd„ de jƒZ	dS )é    N)ÚShadow)ÚOptionsÚCythonScopeÚ
PyrexTypesÚErrorsc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
Ú
TestShadowc           	      C   sØ   g }g }t j ¡ D ]T}| d¡^}}t j |¡}|r1t|ƒdkr1|d dkr1tt|ƒr0| 	|¡ q	|dkr6q	tt|ƒsA| 	|¡ q	|r]t
t|ƒ}|D ]}tt|ƒdƒsZtt|ƒdƒr\ nqJq	|  |g ¡ |  |g ¡ d S )NÚ.é   r   ÚmoduleÚstaticmethodÚ__getattr__Ú__getattribute__)r   Zdirective_typesÚkeysÚsplitZdirective_scopesÚgetÚlenÚhasattrr   ÚappendÚgetattrÚtypeÚassertEqual)	ÚselfZmissing_directivesZextra_directivesZfull_directiveÚ	directiveÚrestÚscopeZdirective_valueZsubdirective© r   úX/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/Cython/Tests/TestShadow.pyÚtest_all_directives_in_shadow   s0   



ÿý€z(TestShadow.test_all_directives_in_shadowc                 C   sb   t  d ¡}g }|j ¡ D ]}| d¡r| d¡rq|dv rqtt|ƒs(| |¡ q|  	|g ¡ d S )NÚ__)ZPyTypeObjectZPyObject_TypeCheck)
r   Úcreate_cython_scopeÚentriesr   Ú
startswithÚendswithr   r   r   r   )r   Úcython_scopeÚmissing_typesÚkeyr   r   r   Útest_all_types_in_shadow$   s   


€z#TestShadow.test_all_types_in_shadowc                 C   s´   g }t jD ]L}dD ]G}|| }|r,|dv s|dkr,|  |tt ƒ¡ |  d| tt ƒ¡ q	tt |ƒs6| |¡ tddƒD ]}d| d | }tt |ƒsO| |¡ q;q	q|  |g ¡ d S )	N)Ú ÚuÚs)Z
Py_UNICODEZPy_UCS4Z
Py_ssize_tZssize_tZ	ptrdiff_tZ	Py_hash_tZusize_tZp_r	   é   ÚpÚ_)r   Z	int_typesZassertNotInÚdirr   r   Úranger   )r   r$   Zint_nameÚsignÚnameÚptrÚptr_namer   r   r   Útest_int_types_in_shadow6   s(   




€ýðz#TestShadow.test_int_types_in_shadowc                 C   sÞ   t  d ¡}G dd„ dƒ}||_t ¡  g }g }tj ¡ D ]D\\}}}}|dkr(qtt	|ƒs2| 
|¡ | |¡s<| 
|¡ tddƒD ]}	d|	 d | }
tt	|
ƒsU| 
|
¡ | |
¡s_| 
|
¡ qAq|  |g ¡ |  |g ¡ d S )Nc                   @   s   e Zd ZdZdZg ZdS )z+TestShadow.test_most_types.<locals>.ContextFé   N)Ú__name__Ú
__module__Ú__qualname__ÚcppZlanguage_levelZfuture_directivesr   r   r   r   ÚContextU   s    r9   Úobjectr	   r*   r+   r,   )r   r   Ú_contextr   Zinit_threadr   Zmodifiers_and_name_to_typeÚitemsr   r   r   Zlookup_typer.   r   )r   r#   r9   r$   Zmissing_lookupsÚsignedZlongnessr0   Útype_r1   r2   r   r   r   Útest_most_typesO   s.   








€ûzTestShadow.test_most_typesN)r5   r6   r7   r   r&   r3   r?   r   r   r   r   r      s
    r   )
ZunittestÚCythonr   ZCython.Compilerr   r   r   r   ZTestCaser   r   r   r   r   Ú<module>   s    