Skip to content

Introduce a legend for - and + in diff outputs#14756

Merged
The-Compiler merged 1 commit into
pytest-dev:mainfrom
lovetheguitar:feat/introduce-diff-legend
Jul 22, 2026
Merged

Introduce a legend for - and + in diff outputs#14756
The-Compiler merged 1 commit into
pytest-dev:mainfrom
lovetheguitar:feat/introduce-diff-legend

Conversation

@lovetheguitar

Copy link
Copy Markdown
Contributor

Now:

test_hello_2 - assert [1, 2, 3, 40, 5, 6] == [1, 2, 3, 4, 5, 6, 7]

  At index 3 diff: 40 != 4
  Right contains one more item: 7

  Full diff: (-: missing in left side, +: extra in left side)
    [
        1,
        2,
        3,
  -     4,
  +     40,
  ?      +
        5,
        6,
  -     7,
    ]

Before:

test_hello_2 - assert [1, 2, 3, 40, 5, 6] == [1, 2, 3, 4, 5, 6, 7]

  At index 3 diff: 40 != 4
  Right contains one more item: 7

  Full diff:
    [
        1,
        2,
        3,
  -     4,
  +     40,
  ?      +
        5,
        6,
  -     7,
    ]

Now:

```console
test_hello_2 - assert [1, 2, 3, 40, 5, 6] == [1, 2, 3, 4, 5, 6, 7]

  At index 3 diff: 40 != 4
  Right contains one more item: 7

  Full diff: (-: missing in left side, +: extra in left side)
    [
        1,
        2,
        3,
  -     4,
  +     40,
  ?      +
        5,
        6,
  -     7,
    ]

```

Before:

```console
test_hello_2 - assert [1, 2, 3, 40, 5, 6] == [1, 2, 3, 4, 5, 6, 7]

  At index 3 diff: 40 != 4
  Right contains one more item: 7

  Full diff:
    [
        1,
        2,
        3,
  -     4,
  +     40,
  ?      +
        5,
        6,
  -     7,
    ]

```

Closes pytest-dev#14743
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 22, 2026
@lovetheguitar
lovetheguitar marked this pull request as ready for review July 22, 2026 08:24
@The-Compiler
The-Compiler enabled auto-merge (squash) July 22, 2026 08:34

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice !

@The-Compiler
The-Compiler disabled auto-merge July 22, 2026 10:18
@The-Compiler
The-Compiler merged commit d07c5d4 into pytest-dev:main Jul 22, 2026
65 of 67 checks passed
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.

3 participants