Skip to content

test: cover AST analyzer edge cases#716

Open
charles-openclaw wants to merge 1 commit into
imDarshanGK:mainfrom
charles-openclaw:add-ast-analyzer-edge-tests
Open

test: cover AST analyzer edge cases#716
charles-openclaw wants to merge 1 commit into
imDarshanGK:mainfrom
charles-openclaw:add-ast-analyzer-edge-tests

Conversation

@charles-openclaw
Copy link
Copy Markdown

Description

Adds focused AST analyzer edge-case coverage for existing behavior:

  • keyword-only mutable defaults are detected
  • unreachable code in async functions is detected
  • used from ... import ... as ... aliases are not reported as unused
  • star imports are skipped by unused-import detection

Related Issue

Fixes #466

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

N/A - backend tests only.

Test evidence

cd backend
PATH="$HOME/.local/bin:$PATH" uv run --with-requirements requirements.txt pytest -v
# 376 passed, 2 warnings in 7.34s

Additional focused check before the full suite:

PATH="$HOME/.local/bin:$PATH" uv run --with-requirements backend/requirements.txt pytest backend/tests/test_ast_analyzer.py backend/tests/test_python_ast_analyzer.py -q
# 51 passed in 0.11s

Also ran:

git diff --check

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.

Add unit tests for ast_analyzer edge cases

1 participant