testing/example_scripts/warnings/test_group_warnings_by_message_summary/test_1.py
raw| 1 | # mypy: allow-untyped-defs |
| 2 | from __future__ import annotations |
| 3 | |
| 4 | import warnings |
| 5 | |
| 6 | import pytest |
| 7 | |
| 8 | |
| 9 | def func(msg): |
| 10 | warnings.warn(UserWarning(msg)) |
| 11 | |
| 12 | |
| 13 | @pytest.mark.parametrize("i", range(20)) |
| 14 | def test_foo(i): |
| 15 | func("foo") |
| 16 | |
| 17 | |
| 18 | def test_foo_1(): |
| 19 | func("foo") |
| 20 | |
| 21 | |
| 22 | @pytest.mark.parametrize("i", range(20)) |
| 23 | def test_bar(i): |
| 24 | func("bar") |