
    J/Ph@                         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e          Ze	dk    r e j
                     dS dS )    Nnjit)TestCase)get_func_body_first_linenoc                   T    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Z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                 t    t          j                    }t          j        |          }|d         j        j        S )N   )inspectcurrentframegetouterframesframef_code)selfr   caller_frames      `/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/tests/test_firstlinefinder.py_get_grandparent_caller_codez0TestFirstLineFinder._get_grandparent_caller_code   s0    $&&-e44A$++    c                 n    |                                  }|j        }|                     |||z              d S N)r   co_firstlinenoassertEqual)r   expectedoffset_from_callergrandparent_colnos        r   assert_line_locationz(TestFirstLineFinder.assert_line_location   s=    ::<<+3);#;<<<<<r   c                 p    t           d             }t          |          }|                     |d           d S )Nc                      dS N    r"   r   r   foozBTestFirstLineFinder.test_decorated_odd_comment_indent.<locals>.foo   s	     1r      r   r   r   r   r#   first_def_lines      r   !test_decorated_odd_comment_indentz5TestFirstLineFinder.test_decorated_odd_comment_indent   sF    		 	 
	 4C88!!.!44444r   c                 p    d }t          t          |                    }|                     |d           d S )Nc                      dS r    r"   r"   r   r   r#   zDTestFirstLineFinder.test_undecorated_odd_comment_indent.<locals>.foo#   s    1r      )r   r   r   r&   s      r   #test_undecorated_odd_comment_indentz7TestFirstLineFinder.test_undecorated_odd_comment_indent"   sB    	 	 	 4DII>>!!.!44444r   c                 n    d }t          t          |                    }|                     |           d S )Nc                      dS r    r"   r"   r   r   <lambda>z9TestFirstLineFinder.test_unnamed_lambda.<locals>.<lambda>+   s    a r   )r   r   assertIsNoner&   s      r   test_unnamed_lambdaz'TestFirstLineFinder.test_unnamed_lambda*   s6    i3DII>>.)))))r   c                 j    d } |            }t          |          }|                     |d           d S )Nc                  &    t           d             } | S )Nc                      dS r    r"   r"   r   r   r#   zBTestFirstLineFinder.test_nested_function.<locals>.foo.<locals>.foo2   s	     qr   r   )r#   s    r   r#   z5TestFirstLineFinder.test_nested_function.<locals>.foo1   s"      T Jr      )r   r   )r   r#   innerr'   s       r   test_nested_functionz(TestFirstLineFinder.test_nested_function0   sG    	 	 	 3E::!!.!44444r   c                 p    t           d             }t          |          }|                     |d           d S )Nc                      d S r   r"   r"   r   r   r#   z4TestFirstLineFinder.test_pass_statement.<locals>.foo>   s    Dr   r+   r%   r&   s      r   test_pass_statementz'TestFirstLineFinder.test_pass_statement=   sF    		 	 
	 4C88!!.!44444r   c                     d}i }t          ||           |d         }t          |          }|                     |           d S )Nz$def foo():
            pass
        r#   )execr   r0   )r   sourceglobalnsr#   r'   s        r   test_string_evalz$TestFirstLineFinder.test_string_evalE   sP     VXuo3C88.)))))r   c                 p    t           d             }t          |          }|                     |d           d S )Nc                      d S r   r"   r"   r   r   r#   z:TestFirstLineFinder.test_single_line_function.<locals>.fooS   s    4r   r
   r%   r&   s      r   test_single_line_functionz-TestFirstLineFinder.test_single_line_functionR   s=    	 
3C88!!.!44444r   c                 p    t           d             }t          |          }|                     |d           d S )Nc                      dS zDocstring
            Nr"   r"   r   r   r#   z/TestFirstLineFinder.test_docstring.<locals>.fooZ   s	     Dr   r5   r%   r&   s      r   test_docstringz"TestFirstLineFinder.test_docstringY   sF    		 	 
	
 4C88!!.!44444r   c                 p    t           d             }t          |          }|                     |d           d S )Nc                      	 dS rE   r"   r"   r   r   r#   z1TestFirstLineFinder.test_docstring_2.<locals>.food   s    Dr   r5   r%   r&   s      r   test_docstring_2z$TestFirstLineFinder.test_docstring_2c   sF    		 	 
	 4C88!!.!44444r   N)__name__
__module____qualname____doc__r   r   r(   r,   r1   r7   r:   r?   rB   rF   rI   r"   r   r   r   r   	   s         
, , ,
= = =
5 5 55 5 5* * *5 5 55 5 5* * *5 5 55 5 55 5 5 5 5r   r   __main__)unittestr   numbar   numba.tests.supportr   numba.misc.firstlinefinderr   r   rJ   mainr"   r   r   <module>rT      s            ( ( ( ( ( ( A A A A A Ae5 e5 e5 e5 e5( e5 e5 e5P zHMOOOOO r   