Skip to content

fix: use actual function name in testing suggestion example (#855)#1033

Open
Mithra-J wants to merge 2 commits into
imDarshanGK:mainfrom
Mithra-J:fix/855-testing-suggestion-example-label
Open

fix: use actual function name in testing suggestion example (#855)#1033
Mithra-J wants to merge 2 commits into
imDarshanGK:mainfrom
Mithra-J:fix/855-testing-suggestion-example-label

Conversation

@Mithra-J

Copy link
Copy Markdown

Fix: Testing suggestion example now reflects actual code (#855)

Problem

The "Testing" suggestion always showed a hardcoded def test_add()
example regardless of the input code. For print("Hello world"),
this made results look completely unrelated to the actual input.

Root Cause

run_suggestions had a static hardcoded string as the example field
for the Testing suggestion.

Fix

  • Dynamically extract function names from submitted code using regex
  • Use the first real function name in the example (e.g. def test_greet)
  • Return None when no functions exist — frontend skips the diff block

Tests Added

  • test_testing_suggestion_no_example_for_no_functions
  • test_testing_suggestion_uses_actual_function_name

Fixes #855

…nGK#855)

- Extract function names from submitted code using regex
- Use first real function name in testing example (e.g. def test_greet)
- Return None when no functions exist (e.g. one-liners like print())
- Frontend: skip diff block when example is null
- Add 2 tests to verify behavior

Fixes imDarshanGK#855
@Mithra-J Mithra-J requested a review from imDarshanGK as a code owner June 12, 2026 06:36
@imDarshanGK

Copy link
Copy Markdown
Owner

Please add a short demo (video/screenshot) showing only the feature working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Code analysis results are irrelevant to the input code

2 participants