Skip to content

test: add dedicated test coverage for diffs.py module#5009

Open
1Ckpwee wants to merge 1 commit intoAider-AI:mainfrom
1Ckpwee:test/add-diffs-tests
Open

test: add dedicated test coverage for diffs.py module#5009
1Ckpwee wants to merge 1 commit intoAider-AI:mainfrom
1Ckpwee:test/add-diffs-tests

Conversation

@1Ckpwee
Copy link
Copy Markdown

@1Ckpwee 1Ckpwee commented Apr 8, 2026

Summary

aider/diffs.py handles streaming diff display but had no dedicated tests. This PR adds 27 tests covering the module's public API.

Test coverage added

  • create_progress_bar() (4 tests): 0%, 50%, 100%, fractional percentages
  • assert_newlines() (5 tests): empty list, valid lines, last-line tolerance, missing newline / empty string raises
  • find_last_non_deleted() (7 tests): identical content, partial updates, changed lines, no common lines, empty inputs
  • diff_partial_update() (11 tests): empty return on no common lines, diff block rendering, final vs streaming mode, fname headers, new file creation, file deletion, backtick escaping, progress bar percentage, output formatting

Test plan

  • All 27 tests pass locally (pytest tests/basic/test_diffs.py -v — 0.03s)
  • CI validation

Cover all public functions: create_progress_bar, assert_newlines,
find_last_non_deleted, and diff_partial_update. Tests include edge
cases for empty content, identical content, new file creation, file
deletion, backtick escaping, progress bar rendering, and fname headers.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 8, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants