
    -Sh                        d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl	m
Z
 ddlZddlmZ ddlmZ ej                            ej                            ej                            ej                  d	                    Zd
 Z G d de          Z G d d e
eej                            Zd Zedk    r ej                     dS dS )z3Tests for generating code from a non-annotated ast.    )absolute_import)division)print_functionN)with_metaclass)codegen)
test_utilsz../testdatac                     t          | d          5 }	 t          j        |                                           n# t          $ r Y d d d            dS w xY w	 d d d            n# 1 swxY w Y   dS )NrFT)openastparsereadSyntaxError)filepathfs     ]/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/pasta/base/codegen_test.py_is_syntax_validr   "   s    Hc a	i   	                      
 
s1   A#&:A#
AA#AA##A'*A'c                       e Zd Zd ZdS )AutoFormatTestMetac                    d }d}t           j                            t          d          }t          j        |          D ]\  }}}	|	D ]z}
|
                    d          rct           j                            ||
          } t          j        t          |           d           ||                    |||
d d         z   <   {t          
                    | |||          S )Nc                       fd}|S )Nc                     t          d          5 }|                                }d d d            n# 1 swxY w Y   t          j        |          }t	          j        |          }|                     ||           d S )Nr
   )r   r   r   r   r   to_strassertMultiLineEqual)selfhandlesrctauto_formatted
input_files        r   testzLAutoFormatTestMeta.__new__.<locals>.auto_format_test_generator.<locals>.test0   s    *c"" 	f#	 	 	 	 	 	 	 	 	 	 	 	 	 	 	IcNN **!!#~66666s   377 )r    r!   s   ` r   auto_format_test_generatorz>AutoFormatTestMeta.__new__.<locals>.auto_format_test_generator/   s#    7 7 7 7 7 k    test_auto_format_r   z.inz3Test contains syntax not supported by this version.)ospathjoinTESTDATA_DIRwalkendswithunittestskipIfr   type__new__)mcsnamebases	inst_dictr#   test_method_prefixdata_dirdirpath_filesfilename	full_paths               r   r0   zAutoFormatTestMeta.__new__-   s       -w||L)44HWX.. 7 7E 7 7(U## 	7gll7H55);(/"9---C; ; +*955;7 ;7)&#2#6
77 <<T5)444r$   N)__name__
__module____qualname__r0   r"   r$   r   r   r   +   s#        5 5 5 5 5r$   r   c                       e Zd ZdZd Z ej        d          d             Z ej        d          d             Zd Z	dS )	AutoFormatTestz:Tests that code without formatting info is printed neatly.c                     d}t          j        |          }|                     |t          j        |                     d S )Nz1from a import b
import c, d
from ..e import f, g
r   r   assertEqualpastadumpr   r   r   s      r   test_importszAutoFormatTest.test_importsI   s8    
@C	#AS%*Q--(((((r$   	exec_nodec                     d}t          j        |          }|                     dt          j        |                     d S )Nzexec foo in barzexec(foo, bar)
rB   rF   s      r   test_exec_node_defaultz%AutoFormatTest.test_exec_node_defaultN   s9    
C	#A'A77777r$   
bytes_nodec                     d}t          j        |          }|                     dt          j        |                     d S )Nzb'foo'zb'foo'
rB   rF   s      r   
test_byteszAutoFormatTest.test_bytesT   s8    
C	#AZA/////r$   c                    dD ]}d|z   dz   }t          j        |          }|j                            t	          j        d          j                   |                     t          j        |          |dz   |z   dz              d S )N)z  z    	z	def a():
zb
z
def c(): dz	def c():
zd
)rD   r   bodyextendr   rC   r   r   )r   indentr   r   s       r   test_default_indentationz'AutoFormatTest.test_default_indentationZ   s    & < <& 5(c
+c

afmmCIl++0111
w~a((\)F2U:< < < <	< <r$   N)
r<   r=   r>   __doc__rG   r   requires_featuresrJ   rM   rS   r"   r$   r   r@   r@   F   s        BB) ) )
  :,,8 8 -,8
  :--0 0 .-0
< < < < <r$   r@   c                      t          j                    } |                     t          j        t                               | S )N)r-   	TestSuiteaddTests	makeSuiter@   )results    r   suiter[   c   s2    &//($^44555	-r$   __main__)rT   
__future__r   r   r   r   os.pathr'   r-   sixr   rD   
pasta.baser   r   r(   realpathr)   dirname__file__r*   r   r/   r   TestCaser@   r[   r<   mainr"   r$   r   <module>rf      s   9 9 ' & & & & &       % % % % % % 



                ! ! ! ! ! !wGLL00-@@B B  5 5 5 5 5 5 5 56< < < < <^^$6
8KLL < < <:   z(-///// r$   