Open
Description
input:
import pytest
def sut():
return [(1.0, 1.0)]
def test_approx():
assert sut() == pytest.approx([(2.0, 2.0)])
output:
===================== test session starts ======================
platform darwin -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/thomas/projects/demo_assertion
collected 1 item
test_approx.py F [100%]
=========================== FAILURES ===========================
_________________________ test_approx __________________________
def test_approx():
> assert sut() == pytest.approx([(2.0, 2.0)])
E AssertionError: assert [(1.0, 1.0)] == approx([(2.0, 2.0)])
E
E (pytest_assertion plugin: representation of details failed: /Users/thomas/.virtualenvs/demo_assertion/lib/python3.12/site-packages/_pytest/python_api.py:343: AttributeError: 'tuple' object has no attribute 'expected'.
E Probably an object has a faulty __repr__.)
test_approx.py:9: AssertionError
=================== short test summary info ====================
FAILED test_approx.py::test_approx - AssertionError: assert [(1.0, 1.0)] == approx([(2.0, 2.0)])
====================== 1 failed in 0.01s =======================
pip list:
Package Version
--------- -------
iniconfig 2.0.0
packaging 24.1
pip 24.2
pluggy 1.5.0
pytest 8.3.3
uname -a: Darwin Thomass-MacBook-Pro.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8122 arm64
- a detailed description of the bug or problem you are having
- output of
pip list
from the virtual environment you are using - pytest and operating system versions
- minimal example if possible
Metadata
Metadata
Assignees
Labels
No labels