Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want a rule that will check pytest.approx parameters #254

Open
henzef opened this issue Aug 9, 2023 · 0 comments
Open

I want a rule that will check pytest.approx parameters #254

henzef opened this issue Aug 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@henzef
Copy link

henzef commented Aug 9, 2023

Rule request

Description

I think a rule to test that all arguments but the first of pytest.approx() are keyword arguments would be useful

example (bad):

assert get_some_value() == pytest.approx(10, 5)

example (very bad):

assert get_some_value() == pytest.approx(1.1, 0, 4, True)

example (good):

assert get_some_value() == pytest.approx(10, abs=5)
assert get_some_value() == pytest.approx(10, rel=0.5)

Rationale

We had several issues because people thought that "abs" was the first parameter and when they omitted the keyword argument, the checked tolerance was suddenly much larger.
Plus I think it makes reading the code much easier.

@henzef henzef added the enhancement New feature or request label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant