o
    2g                     @  s   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mZmZmZmZmZmZmZ dd
lmZ ddlmZ dgZG dd deZdS )zTest runner for reference count opcode insertion transform test cases.

The transform inserts needed reference count increment/decrement
operations to IR.
    )annotationsN)CompileError)test_temp_dir)DataDrivenTestCase)TOP_LEVEL_NAME)format_func)ICODE_GEN_BUILTINSMypycDataSuiteassert_test_outputbuild_ir_for_single_file%infer_ir_build_options_from_test_nameremove_comment_linesreplace_word_sizeuse_custom_builtins)insert_ref_count_opcodes)insert_uninit_checkszrefcount.testc                   @  s"   e Zd ZeZeZdZd	ddZdS )
TestRefCountTransformTtestcaser   returnNonec                 C  s   t |j}|du rdS ttj| jt|Y t|j	}t
|}zt|j|}W n ty= } z	|j}W Y d}~n'd}~ww g }|D ]}|jtkrP|jdsPqBt| t| |t| qBt||d| W d   dS 1 srw   Y  dS )z4Perform a runtime checking transformation test case.N	_toplevelzInvalid source code output)r   namer   ospathjoindata_prefixr   r   outputr   r   inputr   messagesr   endswithr   r   extendr   r
   )selfr   optionsexpected_outputireactualfn r(   P/home/garg/my-data/venv/lib/python3.10/site-packages/mypyc/test/test_refcount.pyrun_case%   s*   

"zTestRefCountTransform.run_caseN)r   r   r   r   )__name__
__module____qualname__filesr   	base_pathoptional_outr*   r(   r(   r(   r)   r       s
    r   )__doc__
__future__r   os.pathr   mypy.errorsr   mypy.test.configr   mypy.test.datar   mypyc.commonr   mypyc.ir.pprintr   mypyc.test.testutilr   r	   r
   r   r   r   r   r   mypyc.transform.refcountr   mypyc.transform.uninitr   r.   r   r(   r(   r(   r)   <module>   s    (
