MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_match_regex

Method test_match_regex

testing/test_recwarn.py:371–381  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

369 result.stdout.fnmatch_lines(["*2 passed in*"])
370
371 def test_match_regex(self) -> None:
372 with pytest.warns(UserWarning, match=r"must be \d+$"):
373 warnings.warn("value must be 42", UserWarning)
374
375 with pytest.raises(pytest.fail.Exception):
376 with pytest.warns(UserWarning, match=r"must be \d+$"):
377 warnings.warn("this is not here", UserWarning)
378
379 with pytest.raises(pytest.fail.Exception):
380 with pytest.warns(FutureWarning, match=r"must be \d+$"):
381 warnings.warn("value must be 42", UserWarning)
382
383 def test_one_from_multiple_warns(self) -> None:
384 with pytest.warns(UserWarning, match=r"aaa"):

Callers

nothing calls this directly

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected