pytest-dev / pytest-dev/pytest
assertion diffs: slightly confusing full diff for `range`
Open
Nobody has claimed this yet.
topic: rewrite
type: enhancement
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
> assert range(5) == range(7)
E assert range(0, 5) == range(0, 7)
E Right contains 2 more items, first extra item: 5
E Full diff:
E - range(0, 7)
E ? ^
E + range(0, 5)
E ? ^
This is what pprint.pformat returns.
It could handle range classes in a special way and call list on them maybe before.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shown range assertion first, then trace pytest's assertion-diff formatting and the pprint.pformat result for range values. Done means the full diff presents range(5) versus range(7) without confusing character-only markers, with regression coverage for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100