
    ڏDjA                     d    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e      Z	 G d d	e      Z
y)
    N)TestCase   )Naming)_indent_chunkUtilityCodeprocess_utility_ccodec                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	
TestIndentc                 l   t        d      D ]  }t        j                  |d|z        }|j                         D ]2  }| j	                  |dk(  xs |j                         t        |             4 | j                  |      5  t        ||      }| j                  ||       d d d         y # 1 sw Y   xY w)N     )indentation)indentation_length)
rangetextwrapindent
splitlines
assertTruestripreprsubTestr   assertEqual)selfchunkexpectedr   expected_indentedlineresults          bC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\Cython/Compiler/Tests/TestCode.py_test_indentationszTestIndent._test_indentations   s     9 	<K (#:K L)446 H
 :djjlDJGH +6 <&uM  !2F;< <	<< <s   ? B**B3	c                 (    | j                  dd       y )Nr   r!   r   s    r    test_indent_emptyzTestIndent.test_indent_empty   s    B'    c                     | j                  dd       | j                  dd       | j                  dd       | j                  dd       | j                  dd       y )N


z


z 
 
z
  
 
    
z



r#   r$   s    r    test_indent_empty_linesz"TestIndent.test_indent_empty_lines   sS    d+//0 16:r&   c                 (    | j                  dd       y )Nabcr#   r$   s    r    test_indent_one_linezTestIndent.test_indent_one_line   s    u-r&   c                 0    d}d}| j                  ||       y )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   s      r    test_indent_chunkzTestIndent.test_indent_chunk    s"     	x0r&   c                 0    d}d}| j                  ||       y )N
            x = 1

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

if x == 2:
    print("False")
else:
    print("True")
r#   r/   s      r    test_indent_empty_linez!TestIndent.test_indent_empty_line1   s"     	x0r&   c                 |    dj                  d      }d|d<   dj                  |      }d}| j                  ||       y )Nr2   T)keependsz            
r   r   r3   )r   joinr!   )r   linesr   r   s       r    test_indent_empty_line_uncleanz)TestIndent.test_indent_empty_line_uncleanD   sK     JJ% 	 $a 	x0r&   N)
__name__
__module____qualname__r!   r%   r*   r-   r0   r4   r9    r&   r    r
   r
      s%    	<(;.1"1&1r&   r
   c                   6    e Zd Zd Zd	dedefdZd Zd Zd Zy)
TestUtilityCodeProcessingc                 \    t               }t        |d |      \  }}| j                  |       |S )N)r   r   assertFalse)r   codeutility_codeformatted_codeis_module_specifics        r    _processz"TestUtilityCodeProcessing._process[   s4    "}-B<QUW[-\**+,r&   rB   r   c                     |rt        j                  |      }|j                         dz   }| j                  |      }| j	                  ||       y )Nr)   )r   dedentr   rF   r   )r   rB   r   rH   	formatteds        r    assert_formatted_codez/TestUtilityCodeProcessing.assert_formatted_codea   sB    x0H>>#f,MM$'	H-r&   c                 ,    | j                  ddd       y )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   rH   )rJ   r$   s    r    test_format_cstringz-TestUtilityCodeProcessing.test_format_cstringh   s$    "" $  	# 	r&   c           
          | j                  ddt        j                   dt        j                   dt        j                   d       y )NzB
        CGLOBAL(name)
        NAMED_CGLOBAL(empty_tuple)
        	
        z->name
        ->r   )rJ   r   modulestateglobal_cnameempty_tupler$   s    r    test_cglobalz&TestUtilityCodeProcessing.test_cglobalx   sS    "" $			'	'( )			'	'(6+=+=*> ?		 	# 	r&   c                    | 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       y )Nz
        EMPTY(tuple)EMPTY(bytes)
        EMPTY(tuple);EMPTY(bytes)
        EMPTY(unicode)
        EMPTY(bytes)
        EMPTY(tuple)
        rN   rO   ;rP   )rJ   r   rQ   rR   empty_bytesempty_unicoder$   s    r    test_empty_builtinz,TestUtilityCodeProcessing.test_empty_builtin   s    "" $			'	'(6+=+=*>v?]?]>^^`agasas`t u			'	'(6+=+=*>a@^@^?__abhbtbtau v			'	'(6+?+?*@ A			'	'(6+=+=*> ?			'	'(6+=+=*> ?	 	# 	r&   N)F)	r:   r;   r<   rF   strrJ   rL   rS   rX   r=   r&   r    r?   r?   Z   s)    .# . . r&   r?   )r   unittestr   r   r   Coder   r   r   r
   r?   r=   r&   r    <module>r\      s/       D DP1 P1f6 6r&   