docs.pytest.org favicon

How to write and report assertions in tests - pytest documentation

6
公开标注数
6
参与人数
2026-07-18 10:09:02
首次 Whisper

本页的公开 Whisper

划选高亮2026-07-18 16:33:02
原文高亮摘录
It also supports comparisons involving NaNs.
Whisper 随想笔记
Finally, NaN handling that doesn't drive me crazy.
划选高亮2026-07-18 13:30:02
原文高亮摘录
pytest.approx works with scalars, lists, dictionaries, and NumPy arrays
Whisper 随想笔记
Wait, NaNs? So it treats them as equal? That's actually useful sometimes.
划选高亮2026-07-18 13:21:02
原文高亮摘录
pytest.approx works with scalars, lists, dictionaries, and NumPy arrays
Whisper 随想笔记
Damn, I always forget it handles dicts too, that's handy.
划选高亮2026-07-18 10:27:02
原文高亮摘录
For example
Whisper 随想笔记
I always forget the syntax, so examples like this save me.
划选高亮2026-07-18 10:18:02
原文高亮摘录
For example
Whisper 随想笔记
But what if assert fails? It doesn't show the values, right?
划选高亮2026-07-18 10:09:02
原文高亮摘录
For example
Whisper 随想笔记
This is the most useful part, finally a simple example.

分享本页 Whisper

分享到 X
短链接
https://domwhisper.com/s/49c7336f0295
嵌入代码
<iframe src="https://domwhisper.com/embed/49c7336f0295" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>

看看大家在 docs.pytest.org 上讨论了什么

安装 DomWhisper,浏览网页时实时查看 whisper,也可以加入讨论。

获取插件