diff --git a/tests/test_line_profiler.py b/tests/test_line_profiler.py index 85860b2a..46322dbc 100644 --- a/tests/test_line_profiler.py +++ b/tests/test_line_profiler.py @@ -578,3 +578,48 @@ def test_sys_monitoring(): assert tool is None, ( f'Expected no active profiling tool after profiling, got {tool!r}' ) + + +def test_profile_generated_code(): + """ + Test that profiling shows source information with generated code. + """ + import linecache + from line_profiler import LineProfiler + from line_profiler.line_profiler import is_generated_code + + # Simulate generated code in linecache + + # Note: this test will fail if the generated code name does not + # start with "