hjwp / hjwp/pytest-icdiff

Improve pytest.approx on lists

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
329
Forks
16
PR merge metrics
No merged PRs in 30d

Description

When a [`pytest.approx`](https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest-approx) with a list of values is failing, current pretty-print is not super readable compared to simple lists:

```py
import pytest

def test_approx():
assert pytest.approx([100, 100, 100], abs=1) == [90, 100, 110]

def test_ints():
assert [100, 100, 100] == [90, 100, 110]
```

![image](https://user-images.githubusercontent.com/1451988/196372580-fcd7a42c-5967-4060-b0fe-0c43843dda57.png)

Since pytest-icdiff already supports approx on single value, do you think it is a doable improvement of printing list values on separate lines too?

And kudo for the plugin!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.