test: add dedicated test coverage for search_replace module#5007
Open
1Ckpwee wants to merge 1 commit intoAider-AI:mainfrom
Open
test: add dedicated test coverage for search_replace module#50071Ckpwee wants to merge 1 commit intoAider-AI:mainfrom
1Ckpwee wants to merge 1 commit intoAider-AI:mainfrom
Conversation
Covers search_and_replace, RelativeIndenter, line_pad/unpad, reverse_lines, strip_blank_lines, flexible_search_and_replace, try_strategy, dmp_apply, and various edge cases (unicode, whitespace, empty strings, tabs, special characters).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
aider/coders/search_replace.pymodule is a core part of how aider applies code edits, but it had no dedicated test file. This PR adds comprehensive test coverage with 47 tests across 8 test classes.Test coverage added
search_and_replace(): exact match, multiple occurrences, no match, multiline, unicode, special charactersRelativeIndenter: roundtrip for various indent patterns, marker selection logic, error cases, multi-text supportline_pad()/line_unpad(): roundtrip, padding structure, invalid input, edge casesreverse_lines(): basic, single line, double-reverse identitystrip_blank_lines(): leading/trailing stripping, internal preservation, trailing newline enforcementflexible_search_and_replace(): strategy selection, preprocessing interactiontry_strategy(): with and without preprocessing, failure pathsdmp_apply(): identical input, complete mismatchTest plan
pytest tests/basic/test_search_replace.py -v— 0.48s)