Skip to content

Approx with inequalities #2003

Closed
Closed
@adler-j

Description

@adler-j

The new approx function is great, but does not seem to work with inequalities, instead failing silently.

I.e.

def test_aprox_inequal():
    assert pytest.approx(0.0) <= 5.0

gives

    def test_aprox_inequal():
>       assert pytest.approx(0.0) <= 5.0
E       assert 0.0 ± 1.0e-12 <= 5.0
E        +  where 0.0 ± 1.0e-12 = <class '_pytest.python.approx'>(0.0)
E        +    where <class '_pytest.python.approx'> = pytest.approx

It would be great if inequality testing was also supported with approx, and if not then this should give a better error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributorstatus: help wanteddevelopers would like help from experts on this topictopic: reportingrelated to terminal output and user-facing messages and errorstype: feature-branchnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions