
    X-PhU                        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 ddlmZ dd	lmZ dd
lmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ ddgZ G d de          ZdS )z|Test runner for exception handling transform test cases.

The transform inserts exception handling branch operations to IR.
    )annotationsN)CompileError)test_temp_dir)DataDrivenTestCase)frequently_executed_blocks)TOP_LEVEL_NAME)format_func)ICODE_GEN_BUILTINSMypycDataSuiteassert_test_outputbuild_ir_for_single_fileremove_comment_linesuse_custom_builtins)insert_exception_handling)insert_ref_count_opcodes)insert_uninit_checkszexceptions.testzexceptions-freq.testc                      e Zd ZeZeZddZdS )TestExceptionTransformtestcaser   returnNonec           	     $   t          t          j                            | j        t
                    |          5  t          |j                  }	 t          |j	                  }g }|D ]}|j
        t          k    r|j
                            d          s-t          |           t          |           t          |           |                    t#          |                     |j
                            d          rIt%          |j        d                   }|                    dt+          d |D                       z             n# t,          $ r}|j        }Y d}~nd}~ww xY wt1          ||d|           ddd           dS # 1 swxY w Y   dS )z4Perform a runtime checking transformation test case.	_toplevel_freqr   zhot blocks: %sc              3  $   K   | ]}|j         V  d S )N)label).0bs     Z/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypyc/test/test_exceptions.py	<genexpr>z2TestExceptionTransform.run_case.<locals>.<genexpr>6   s$      ?X?XA?X?X?X?X?X?X    NzInvalid source code output)r   ospathjoindata_prefixr
   r   outputr   inputnamer   endswithr   r   r   extendr	   r   blocksappendsortedr   messagesr   )selfr   expected_outputiractualfncommones           r   run_casezTestExceptionTransform.run_case#   s    d.>@R!S!SU]^^ 	` 	`28?CCOZ-hn==  	Z 	ZBw.009O9OP[9\9\0 (,,,-b111,R000MM+b//222}--g66 Z!;BIaL!I!I&6?X?XQW?X?X?X9X9X&XYYY	Z	   $ $ $$ x1M___'	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	` 	`s<   FE#C%F
E#EFE##FF	F	N)r   r   r   r   )__name__
__module____qualname__filesr   	base_pathr6    r!   r   r   r      s8        EI` ` ` ` ` `r!   r   ) __doc__
__future__r   os.pathr"   mypy.errorsr   mypy.test.configr   mypy.test.datar   mypyc.analysis.blockfreqr   mypyc.commonr   mypyc.ir.pprintr	   mypyc.test.testutilr
   r   r   r   r   r   mypyc.transform.exceptionsr   mypyc.transform.refcountr   mypyc.transform.uninitr   r:   r   r<   r!   r   <module>rJ      sj   
 # " " " " "  $ $ $ $ $ $ * * * * * * - - - - - - ? ? ? ? ? ? ' ' ' ' ' ' ' ' ' ' ' '                A @ @ @ @ @ = = = = = = 7 7 7 7 7 7	23` ` ` ` `^ ` ` ` ` `r!   