
    xKg@                     |    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                          yy)    Nnjit)TestCase)get_func_body_first_linenoc                   R    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y)TestFirstLineFinderz
    The following methods contains tests that are sensitive to the source
    locations w.r.t. the beginning of each method.
    c                     t        j                         }t        j                  |      }|d   j                  j                  S )N   )inspectcurrentframegetouterframesframef_code)selfr   caller_frames      d/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_firstlinefinder.py_get_grandparent_caller_codez0TestFirstLineFinder._get_grandparent_caller_code   s6    $$&--e4A$$+++    c                 f    | j                         }|j                  }| j                  |||z          y N)r   co_firstlinenoassertEqual)r   expectedoffset_from_callergrandparent_colnos        r   assert_line_locationz(TestFirstLineFinder.assert_line_location   s1    ::<++3);#;<r   c                 V    t         d        }t        |      }| j                  |d       y )Nc                       yN    r"   r   r   foozBTestFirstLineFinder.test_decorated_odd_comment_indent.<locals>.foo   s     r      r   r   r   r   r#   first_def_lines      r   !test_decorated_odd_comment_indentz5TestFirstLineFinder.test_decorated_odd_comment_indent   s0    		 
	 4C8!!.!4r   c                 V    d }t        t        |            }| j                  |d       y )Nc                       yr    r"   r"   r   r   r#   zDTestFirstLineFinder.test_undecorated_odd_comment_indent.<locals>.foo#   s    r      )r   r   r   r&   s      r   #test_undecorated_odd_comment_indentz7TestFirstLineFinder.test_undecorated_odd_comment_indent"   s'    	 4DI>!!.!4r   c                 T    d }t        t        |            }| j                  |       y )Nc                       yr    r"   r"   r   r   <lambda>z9TestFirstLineFinder.test_unnamed_lambda.<locals>.<lambda>+   s    ar   )r   r   assertIsNoner&   s      r   test_unnamed_lambdaz'TestFirstLineFinder.test_unnamed_lambda*   s#    3DI>.)r   c                 R    d } |       }t        |      }| j                  |d       y )Nc                      t         d        } | S )Nc                       yr    r"   r"   r   r   r#   zBTestFirstLineFinder.test_nested_function.<locals>.foo.<locals>.foo2   s     r   r   )r#   s    r   r#   z5TestFirstLineFinder.test_nested_function.<locals>.foo1   s      Jr      )r   r   )r   r#   innerr'   s       r   test_nested_functionz(TestFirstLineFinder.test_nested_function0   s*    	 3E:!!.!4r   c                 V    t         d        }t        |      }| j                  |d       y )Nc                       y r   r"   r"   r   r   r#   z4TestFirstLineFinder.test_pass_statement.<locals>.foo>   s    r   r+   r%   r&   s      r   test_pass_statementz'TestFirstLineFinder.test_pass_statement=   s0    		 
	 4C8!!.!4r   c                 f    d}i }t        ||       |d   }t        |      }| j                  |       y )Nz$def foo():
            pass
        r#   )execr   r0   )r   sourceglobalnsr#   r'   s        r   test_string_evalz$TestFirstLineFinder.test_string_evalE   s;     VXuo3C8.)r   c                 V    t         d        }t        |      }| j                  |d       y )Nc                       y r   r"   r"   r   r   r#   z:TestFirstLineFinder.test_single_line_function.<locals>.fooS   s    r   r
   r%   r&   s      r   test_single_line_functionz-TestFirstLineFinder.test_single_line_functionR   s*    	 
3C8!!.!4r   c                 V    t         d        }t        |      }| j                  |d       y )Nc                       yzDocstring
            Nr"   r"   r   r   r#   z/TestFirstLineFinder.test_docstring.<locals>.fooZ   s     r   r5   r%   r&   s      r   test_docstringz"TestFirstLineFinder.test_docstringY   s0    		 
	
 4C8!!.!4r   c                 V    t         d        }t        |      }| j                  |d       y )Nc                       	 yrE   r"   r"   r   r   r#   z1TestFirstLineFinder.test_docstring_2.<locals>.food   s
    r   r5   r%   r&   s      r   test_docstring_2z$TestFirstLineFinder.test_docstring_2c   s0    		 
	 4C8!!.!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5r   r   __main__)unittestr   numbar   numba.tests.supportr   numba.misc.firstlinefinderr   r   rJ   mainr"   r   r   <module>rT      s=       ( Ae5( e5P zHMMO r   