Skip to content

Mention approx() in the "How to write [..] tests" guide #13662

@Mojert

Description

@Mojert

After months of using pytest, I only recently learned the existence of pytest.approx() through the Scientific Python Development Guide. Knowing this beforehand would have spared me a lot of ugly assert np.isallclose(a,b). I don't think me not knowing about the existence of this function beforehand is my fault because I read the Get Started, How to write and report assertions in tests, and How to use fixtures pages, which I feel like should be enough to start writing tests and have a general idea of what the package is capable of.

Since so many people use Python for scientific computing, I reckon it would be good to at least mention the existence of pytest.approx() in the "How to write and report assertions in tests" guide. Honestly, the fact that it works so well with numpy arrays, even those including NaNs, makes this function a selling point of pytest in my books, so I would argue it could even be included in the "Get Started" page.

If you agree with me that a reference to pytest.approx() should be added to the "How to write and report assertions" guide and/or the "Get Started" page (and you tell me which of these 2 pages should be modified), I'd be more than happy to change the doc myself.

What do you all think about it?

Metadata

Metadata

Assignees

Labels

type: docsdocumentation improvement, missing or needing clarification

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions