o
    j}                     @   sl   d dl Z d dlZd dlZddlmZmZmZmZmZ ddl	m
Z
mZ G dd dejZG dd dejZdS )	    N   )inferred_method_return_types"find_return_type_of_builtin_methodunsafe_compile_time_methodsis_safe_compile_time_methodbuiltin_scope)KNOWN_PYTHON_BUILTINS_VERSIONKNOWN_PYTHON_BUILTINSc                   @   s   e Zd Zdd ZdS )TestBuiltinReturnTypesc           	      C   s   t jdk}t D ]Y\}}tt|dkr|nd}| D ]E\}}t|j}t	||}|j
rWd|v r9|dd }|dkr?|}| |j| |rV| t||| d|  q| |jdd	| qq	d S )
N)   
   unicodestr[r   T.T)pyrex)sysversion_infor   itemsgetattrbuiltinsr   lookuptyper   Zis_builtin_type	partitionZassertEqualnameZ
assertTruehasattrZempty_declaration_code)	selfZlook_up_methods	type_namemethodsZpy_typemethod_nameZreturn_type_namebuiltin_typereturn_type r#   b/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/Cython/Compiler/Tests/TestBuiltin.py'test_find_return_type_of_builtin_method   s$   

z>TestBuiltinReturnTypes.test_find_return_type_of_builtin_methodN)__name__
__module____qualname__r%   r#   r#   r#   r$   r
      s    r
   c                   @   s   e Zd Zdd Zdd ZdS )TestBuiltinCompatibilityc                 C   s|   t t}tjdkr|d tdd ttD }tjt	k r6|| }|r1| 
ddt|  | 
d | || d S )Nwin32ZWindowsErrorc                 s   s    | ]	}|d vr|V  qdS ))__doc__
__loader__r&   __package____spec__Nr#   ).0r   r#   r#   r$   	<genexpr>,   s    zMTestBuiltinCompatibility.test_python_builtin_compatibility.<locals>.<genexpr>z=skipping test, older Python release found. Missing builtins: z, z*skipping test, older Python release found.)setr	   r   platformdiscard	frozensetdirr   r   r   ZskipTestjoinsortedZassertSetEqual)r   Zexpected_builtinsZruntime_builtinsZmissing_builtinsr#   r#   r$   !test_python_builtin_compatibility(   s   



z:TestBuiltinCompatibility.test_python_builtin_compatibilityc                 C   st   t  D ]3\}}| |t tt|}tt| }| |	| |D ]}t||d}|du r6| 
|| q#q#qdS )zValidate the table of builtin methods that are not safe for compile time evaluation
        against the table of known builtin methods (and their types).
        N)r   r   ZassertIsInstancer1   r   r   r7   r   ZassertFalse
differenceZassertIn)r   Zbuiltin_type_nameZunsafe_methodsr!   Zknown_methodsr    Zbuiltin_methodr#   r#   r$    test_unsafe_compile_time_methods6   s   
z9TestBuiltinCompatibility.test_unsafe_compile_time_methodsN)r&   r'   r(   r8   r:   r#   r#   r#   r$   r)   '   s    r)   )r   r   ZunittestBuiltinr   r   r   r   r   ZCoder   r	   ZTestCaser
   r)   r#   r#   r#   r$   <module>   s    