Skip to content

Show correct extra item in sequence comparison diffs - #14906

Open
SemTiOne wants to merge 1 commit into
pytest-dev:mainfrom
SemTiOne:fix/13652-misleading-extra-item-message
Open

Show correct extra item in sequence comparison diffs#14906
SemTiOne wants to merge 1 commit into
pytest-dev:mainfrom
SemTiOne:fix/13652-misleading-extra-item-message

Conversation

@SemTiOne

Copy link
Copy Markdown
Contributor

Sequences of different lengths showed the wrong extra item in the one-liner message. It picked the item at the same index instead of the actual extra one.

E     [1, 2, 3] != [1, 3]
E     test_sequence [1, 3] contains one more item: 3
            != 2

Now it checks whether the tail matches to find the real insertion point.

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.
  • Closes Misleading message "Right contains one more item" #13652
  • If AI agents were used, they are credited in Co-authored-by commit trailers.
  • Create a new changelog file in the changelog directory, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Add yourself to AUTHORS in alphabetical order.

Co-authored-by: Claude <noreply@anthropic.com>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 19, 2026
@SemTiOne
SemTiOne marked this pull request as ready for review August 19, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading message "Right contains one more item"

1 participant