Updates inject_profiling_into_existing_test calls to include test_string
parameter. Takes main's test refactoring for multi-file code replacement
and codeflash capture.
The bug was introduced in commit 06353ea1 which added a fallback that
applied a single code block to ANY file being processed. This caused
issues like PR #1309 where normalize_java_code was duplicated in
support.py because optimized code for formatter.py was incorrectly
applied to it.
The fix restricts the single-code-block fallback to non-Python languages
only, where flexible path matching is needed (Java/JS/TS). For Python,
exact path matching is now required.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Assignments that don't reference module-level definitions are now placed
right after imports. Only assignments that reference classes/functions
are placed after those definitions to prevent NameError.
Update test_no_targets_found to expect outer class to be kept when
targeting nested class methods, and add test for nonexistent targets.
Update test_multi_file_replcement01 to expect global assignments at
module end rather than after imports.