Skip to content

fix: use 0-based byte offset in ps1 encoding test failure message#2710

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-review-comment
Draft

fix: use 0-based byte offset in ps1 encoding test failure message#2710
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-review-comment

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

The failure message in test_ps1_file_is_ascii_only reported "byte offset" but stored i + 1 (1-based), creating an off-by-one inconsistency when debugging encoding failures.

Change

  • tests/test_ps1_encoding.py: Replace i + 1 with i so the recorded position is 0-based, matching the conventional meaning of "byte offset".
# Before
non_ascii = [(i + 1, byte) for i, byte in enumerate(content) if byte > 127]
# "first at byte offset 1" for the very first byte — misleading

# After
non_ascii = [(i, byte) for i, byte in enumerate(content) if byte > 127]
# "first at byte offset 0" for the very first byte — correct

Copilot AI requested review from Copilot and removed request for Copilot May 26, 2026 18:25
Copilot AI requested review from Copilot and removed request for Copilot May 26, 2026 18:26
Copilot AI changed the title [WIP] Fix code based on review comment fix: use 0-based byte offset in ps1 encoding test failure message May 26, 2026
Copilot finished work on behalf of mnriem May 26, 2026 18:26
Copilot AI requested a review from mnriem May 26, 2026 18:26
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