How to write and report assertions in tests - pytest documentation
6
Public whispers
6
Contributors
2026-07-18 10:09:02
First whispered
Public whispers on this page
Text Highlight2026-07-18 16:33:02
Original Highlight Excerpt
"It also supports comparisons involving NaNs."
Whisper Note
Finally, NaN handling that doesn't drive me crazy.
Text Highlight2026-07-18 13:30:02
Original Highlight Excerpt
"pytest.approx works with scalars, lists, dictionaries, and NumPy arrays"
Whisper Note
Wait, NaNs? So it treats them as equal? That's actually useful sometimes.
Text Highlight2026-07-18 13:21:02
Original Highlight Excerpt
"pytest.approx works with scalars, lists, dictionaries, and NumPy arrays"
Whisper Note
Damn, I always forget it handles dicts too, that's handy.
Text Highlight2026-07-18 10:27:02
Original Highlight Excerpt
"For example"
Whisper Note
I always forget the syntax, so examples like this save me.
Text Highlight2026-07-18 10:18:02
Original Highlight Excerpt
"For example"
Whisper Note
But what if assert fails? It doesn't show the values, right?
Text Highlight2026-07-18 10:09:02
Original Highlight Excerpt
"For example"
Whisper Note
This is the most useful part, finally a simple example.
Share this page's whispers
Short link
https://domwhisper.com/s/49c7336f0295Embed snippet
<iframe src="https://domwhisper.com/embed/49c7336f0295" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>See what people are discussing on docs.pytest.org
Install DomWhisper to view live whispers as you browse, and join the discussion.
Get the extension