pytest-dev / pytest-dev/pytest
`AssertionError`s with differing items in dict of lists do not display properly when not running in verbose mode
Open
Nobody has claimed this yet.
topic: reporting
type: enhancement
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
- a detailed description of the bug or problem you are having
when anassertstatement fails where the values being compared aredicts oflists with 8 or more items in the list, it does not show what part of the list was different in the output. - output of
pip listfrom the virtual environment you are using
not using pip - pytest and operating system versions py
pytest 8.0, windows 10/11 - minimal example if possible
def test_something():
value1 = {"asdf": [1, 1, 1, 1, 1, 1, 1, 1]}
value2 = {"asdf": [1, 1, 1, 1, 1, 1, 1, 2]}
assert value1 == value2
AssertionError: assert {'asdf': [1, ...1, 1, 1, ...]} == {'asdf': [1, ...1, 1, 1, ...]}
Differing items:
{'asdf': [1, 1, 1, 1, 1, 1, ...]} != {'asdf': [1, 1, 1, 1, 1, 1, ...]}
Use -v to get more diff
the truncated diff does not show what part was different. it should instead display something like:
Differing items:
{'asdf': [1, 1, 1, ...1, 1]} != {'asdf': [1, 1, 1, ...1, 2]}
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
Start with the provided test_something example under pytest 8.0 on Windows and compare its normal output with the -v output. Trace the assertion comparison and truncation path; done means the non-verbose Differing items section identifies the differing final list value instead of only showing ellipses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100