o
    i@                     @   s\   d dl Z d dlZd dlmZ d dlmZ d dlmZ G dd deZe	dkr,e 
  dS dS )    Nnjit)TestCase)get_func_body_first_linenoc                   @   sh   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )TestFirstLineFinderz
    The following methods contains tests that are sensitive to the source
    locations w.r.t. the beginning of each method.
    c                 C   s   t  }t |}|d jjS )N   )inspectcurrentframegetouterframesframef_code)selfr   caller_frame r   ]/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/numba/tests/test_firstlinefinder.py_get_grandparent_caller_code   s   
z0TestFirstLineFinder._get_grandparent_caller_codec                 C   s"   |   }|j}| |||  d S N)r   co_firstlinenoassertEqual)r   expectedoffset_from_callergrandparent_colnor   r   r   assert_line_location   s   z(TestFirstLineFinder.assert_line_locationc                 C   $   t dd }t|}| |d d S )Nc                   S      dS N   r   r   r   r   r   foo      zBTestFirstLineFinder.test_decorated_odd_comment_indent.<locals>.foo   r   r   r   r   r   first_def_liner   r   r   !test_decorated_odd_comment_indent   s   
z5TestFirstLineFinder.test_decorated_odd_comment_indentc                 C   s$   dd }t t|}| |d d S )Nc                   S   r   r   r   r   r   r   r   r   #      zDTestFirstLineFinder.test_undecorated_odd_comment_indent.<locals>.foo   )r   r   r   r"   r   r   r   #test_undecorated_odd_comment_indent"   s   z7TestFirstLineFinder.test_undecorated_odd_comment_indentc                 C   s"   dd }t t|}| | d S )Nc                   S   r   r   r   r   r   r   r   <lambda>+   s    z9TestFirstLineFinder.test_unnamed_lambda.<locals>.<lambda>)r   r   assertIsNoner"   r   r   r   test_unnamed_lambda*   s   z'TestFirstLineFinder.test_unnamed_lambdac                 C   s&   dd }| }t |}| |d d S )Nc                  S   s   t dd } | S )Nc                   S   r   r   r   r   r   r   r   r   2   r   zBTestFirstLineFinder.test_nested_function.<locals>.foo.<locals>.foor   )r   r   r   r   r   1   s   
z5TestFirstLineFinder.test_nested_function.<locals>.foo   )r   r   )r   r   innerr#   r   r   r   test_nested_function0   s   z(TestFirstLineFinder.test_nested_functionc                 C   r   )Nc                   S      d S r   r   r   r   r   r   r   >   r%   z4TestFirstLineFinder.test_pass_statement.<locals>.foor&   r!   r"   r   r   r   test_pass_statement=   s   
z'TestFirstLineFinder.test_pass_statementc                 C   s0   d}i }t || |d }t|}| | d S )Nz$def foo():
            pass
        r   )execr   r)   )r   sourceglobalnsr   r#   r   r   r   test_string_evalE   s   
z$TestFirstLineFinder.test_string_evalc                 C   r   )Nc                   S   r.   r   r   r   r   r   r   r   S   s   z:TestFirstLineFinder.test_single_line_function.<locals>.foor   r!   r"   r   r   r   test_single_line_functionR   s   
z-TestFirstLineFinder.test_single_line_functionc                 C   r   )Nc                   S   r   zDocstring
            Nr   r   r   r   r   r   Z   s   z/TestFirstLineFinder.test_docstring.<locals>.foor+   r!   r"   r   r   r   test_docstringY   s   
z"TestFirstLineFinder.test_docstringc                 C   r   )Nc                   S   s   	 dS r5   r   r   r   r   r   r   d   s   z1TestFirstLineFinder.test_docstring_2.<locals>.foor+   r!   r"   r   r   r   test_docstring_2c   s   
z$TestFirstLineFinder.test_docstring_2N)__name__
__module____qualname____doc__r   r   r$   r'   r*   r-   r/   r3   r4   r6   r7   r   r   r   r   r   	   s    	
r   __main__)unittestr   numbar   numba.tests.supportr   numba.misc.firstlinefinderr   r   r8   mainr   r   r   r   <module>   s    h