Skip to content

grass.tools: Assert results in levenshtein empty-text test - #734

Open
echoix wants to merge 1 commit into
mainfrom
fix/tools-levenshtein-asserts
Open

echoix wants to merge 1 commit into
mainfrom
fix/tools-levenshtein-asserts

Conversation

@echoix

@echoix echoix commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Description

test_levenshtein_distance_empty_text computed both ToolFunctionResolver.levenshtein_distance results but never asserted them, so the test passed regardless of the value. This PR adds the missing assert statements. The expected values (3 for an empty string against a 3-character string, in both argument orders) match the function, which I checked against a reference Levenshtein implementation.

Motivation and context

Found by ruff's B015 (pointless comparison) check.

How has this been tested?

Ran pytest python/grass/tools/tests/grass_tools_tool_function_wrap_test.py -k levenshtein: 1 passed. Ruff check and ruff format pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • PR title provides summary of the changes and starts with one of the pre-defined prefixes
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Generated by Claude Code

The test computed both levenshtein_distance results but did not assert
them, so it passed regardless of the value. Add the missing asserts.

The change was found and fixed with AI assistance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants