
    X-Ph(
                        d Z ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ dd	lmZmZmZmZmZmZmZ d
gZ G d de          ZdS )zBTest cases for annotating source code to highlight inefficiencies.    )annotationsN)CompileError)test_temp_dir)DataDrivenTestCase)generate_annotationsget_max_prio)format_func)ICODE_GEN_BUILTINSMypycDataSuiteassert_test_outputbuild_ir_for_single_file2%infer_ir_build_options_from_test_nameremove_comment_linesuse_custom_builtinszannotate-basic.testc                  "    e Zd ZeZeZdZddZdS )	
TestReportTtestcaser   returnNonec                @   t          |j                  }|dS t          t          j                            | j        t                    |          5  t          |j	                  }t          |j                  D ]T\  }}d|v rK|                    d          d                                         }|                    d|dz    d|            Ud}	 t          |j        |          \  }}}	}
t!          d|||	|
          }g }t#          |j                                        d 	          D ]P\  }}t)          |          }d
 |D             }d                    |          }|                    d| d|            Qn# t*          $ r}|j        }Y d}~nd}~ww xY w	 t/          ||d|           nW# t0          $ rJ |rFt3          d           |j        D ]/}|j        dk    rt7          |          D ]}t3          |           0 w xY w	 ddd           dS # 1 swxY w Y   dS )z4Perform a runtime checking transformation test case.Nz# A:   zmain:   z: z	native.pyc                    | d         S )Nr    )its    X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypyc/test/test_annotate.py<lambda>z%TestReport.run_case.<locals>.<lambda>6   s
    BqE     )keyc                    g | ]	}|j         
S r   )message).0as     r   
<listcomp>z'TestReport.run_case.<locals>.<listcomp>9   s    888a	888r    zInvalid source code outputzGenerated IR:
__top_level__)r   namer   ospathjoindata_prefixr
   r   output	enumerateinput
rpartitionstripappendr   r   sortedr   itemsr   r   messagesr   BaseExceptionprint	functionsr	   )selfr   optionsexpected_outputilinemsgirtreetype_mapmapperr   actualline_num	line_annsannsstr_annssefns                       r   run_casezTestReport.run_case   s   7FF?F d.>@R!S!SU]^^ #	 #	28?CCO %X^44 C C4T>>//&11!4::<<C#**+A1q5+A+AC+A+ABBBB;-Fx~W^-_-_*D(F 3;b(TZ[[+1+11339I9I, , , ; ;'Hi (	22D884888H**AMM"9("9"9a"9"9::::;   $ $ $$
"8V5QSbcccc     %+,,, l % %7o55$!,R % %A!!HHHH% d5#	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	 #	sW   B HE<,BH<
FFHFHF.-H.AHHHHN)r   r   r   r   )__name__
__module____qualname__filesr   	base_pathoptional_outrJ   r   r   r   r   r      s7        EIL) ) ) ) ) )r   r   )__doc__
__future__r   os.pathr(   mypy.errorsr   mypy.test.configr   mypy.test.datar   mypyc.annotater   r   mypyc.ir.pprintr	   mypyc.test.testutilr
   r   r   r   r   r   r   rN   r   r   r   r   <module>rZ      s   H H " " " " " "  $ $ $ $ $ $ * * * * * * - - - - - - = = = = = = = = ' ' ' ' ' '                  
. . . . . . . . . .r   