Open jkittner opened 2 years ago
I'm gonna try taking a look at this one, will update if I get stuck(this is my first issue in this project).
This might be a tricky one, since some fundamental changes might be necessary. Ronny wrote:
I agree, feature creep happened, problem is that with a surround for the collection, the errors can't be done sanely
We just finished some early design discussions about that last month and it will take a while to manifest
I released the PR anyway, if anything it might be a decent temporary fix.
Hey guys! Not sure what is the state of this issue, but the bug is still there:
>>> pytest.approx([{"a": 0.1}], rel=1e-1) == [{"a": 0.11}]
False
>>> pytest.approx(0.1, rel=1e-1) == 0.11
True
Pytest version is 7.2.0
description
when using
pytest.approx
on nested data structures I'd expect it to raise an exception also for mixed data type containers like atuple
in alist
. So far it only works for the same data types e.g. lists in lists, tuples in tuples. For mixed data structures it incorrectly returnsFalse
, even though they should match which is a little misleading (also see below).output of
pip list
versions
minimal reproduction
however, it works fine if both are exactly the same, but here I'd also expect an exception instead of a result (which is correct, but maybe unintentional)
test cases
These test cases fail, but should pass with the potential bug fixed.