U
    {h                     @   s4   d dl Z d dlmZ ddlmZ G dd deZdS )    N)TestCase   )_indent_chunkc                   @   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 ]n}t|d| }| D ] }| |dkp:| t| q$| j|d t||d}| 	|| W 5 Q R X qd S )N     )indentation)Zindentation_length)
rangetextwrapindent
splitlines
assertTruestripreprZsubTestr   assertEqual)selfchunkexpectedr	   Zexpected_indentedlineresult r   B/tmp/pip-unpacked-wheel-fhl22ezh/Cython/Compiler/Tests/TestCode.py_test_indentations   s    zTestIndent._test_indentationsc                 C   s   |  dd d S )Nr   r   r   r   r   r   test_indent_empty   s    zTestIndent.test_indent_emptyc                 C   s@   |  dd |  dd |  dd |  dd |  dd d S )N
z

z


z 
 
z
  
 
    
z



r   r   r   r   r   test_indent_empty_lines   s
    z"TestIndent.test_indent_empty_linesc                 C   s   |  dd d S )Nabcr   r   r   r   r   test_indent_one_line   s    zTestIndent.test_indent_one_linec                 C   s   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   s   d}d}|  || d S )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_line0   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_uncleanC   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   )r   Zunittestr   ZCoder   r   r   r   r   r   <module>   s   