o
    j                     @   sX   d dl Z d dlmZ ddlmZ ddlmZmZmZ G dd deZ	G dd	 d	eZ
dS )
    N)TestCase   )Naming)_indent_chunkUtilityCodeprocess_utility_ccodec                   @   sD   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dS )
TestIndentc              	   C   s   t dD ]A}t|d| }| D ]}| |dkp| t| q| j|d t||d}| 	|| W d    n1 s@w   Y  qd S )N     )indentation)Zindentation_length)
rangetextwrapindent
splitlinesZ
assertTruestripreprZsubTestr   assertEqual)selfchunkexpectedr   Zexpected_indentedlineresult r   _/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/Cython/Compiler/Tests/TestCode.py_test_indentations   s   zTestIndent._test_indentationsc                 C      |  dd d S )Nr   r   r   r   r   r   test_indent_empty      zTestIndent.test_indent_emptyc                 C   s@   |  dd |  dd |  dd |  dd |  dd d S )N


z


z 
 
z
  
 
    
z



r   r   r   r   r   test_indent_empty_lines   s
   z"TestIndent.test_indent_empty_linesc                 C   r   )Nabcr   r   r   r   r   test_indent_one_line   r    zTestIndent.test_indent_one_linec                 C      d}d}|  || d S )Nz
            x = 1
            if x == 2:
                print("False")
            else:
                print("True")
        z=
x = 1
if x == 2:
    print("False")
else:
    print("True")
r   r   r   r   r   r   r   test_indent_chunk    s   zTestIndent.test_indent_chunkc                 C   r&   )N
            x = 1

            if x == 2:
                print("False")
            else:
                print("True")
        >
x = 1

if x == 2:
    print("False")
else:
    print("True")
r   r'   r   r   r   test_indent_empty_line1   s   z!TestIndent.test_indent_empty_linec                 C   s2   dj dd}d|d< d|}d}| || d S )Nr)   T)keependsz            
r   r   r*   )r   joinr   )r   linesr   r   r   r   r   test_indent_empty_line_uncleanD   s   
z)TestIndent.test_indent_empty_line_uncleanN)
__name__
__module____qualname__r   r   r#   r%   r(   r+   r/   r   r   r   r   r      s    r   c                   @   s@   e Zd Zdd ZddedefddZdd	 Zd
d Zdd ZdS )TestUtilityCodeProcessingc                 C   s$   t  }t|d |\}}| | |S )N)r   r   ZassertFalse)r   codeZutility_codeZformatted_codeZis_module_specificr   r   r   _process[   s   
z"TestUtilityCodeProcessing._processFr4   r   c                 C   s4   |rt |}| d }| |}| || d S )Nr"   )r   dedentr   r5   r   )r   r4   r   r6   	formattedr   r   r   assert_formatted_codea   s
   

z/TestUtilityCodeProcessing.assert_formatted_codec                 C   s   | j dddd d S )Nz
        Some Text and a CSTRING("""
        spanning "multiple" 'lines'.
        Really.
        """);   # end of C string
        z
        Some Text and a "\n"
        "        spanning \042multiple\042 'lines'.\n"
        "        Really.\n"
        "        \n"
        ;   # end of C string
        T)r   r6   )r8   r   r   r   r   test_format_cstringh   s   
z-TestUtilityCodeProcessing.test_format_cstringc              	   C   s,   | j ddtj dtj dtj dd d S )NzB
        CGLOBAL(name)
        NAMED_CGLOBAL(empty_tuple)
        	
        z->name
        ->r   )r8   r   modulestateglobal_cnameempty_tupler   r   r   r   test_cglobalx   s   
z&TestUtilityCodeProcessing.test_cglobalc                 C   s   | j ddtj dtj tj dtj dtj dtj dtj dtj dtj dtj dtj dtj dtj dtj dd d S )Nz
        EMPTY(tuple)EMPTY(bytes)
        EMPTY(tuple);EMPTY(bytes)
        EMPTY(unicode)
        EMPTY(bytes)
        EMPTY(tuple)
        r:   r;   ;r<   )r8   r   r=   r>   Zempty_bytesZempty_unicoder   r   r   r   test_empty_builtin   s>   
z,TestUtilityCodeProcessing.test_empty_builtinN)F)	r0   r1   r2   r5   strr8   r9   r?   rA   r   r   r   r   r3   Z   s    
r3   )r   Zunittestr   r   r   ZCoder   r   r   r   r3   r   r   r   r   <module>   s    S