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

Function test_linematcher_consecutive

testing/test_pytester.py:538–555  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

536
537
538def test_linematcher_consecutive() -> None:
539 lm = LineMatcher(["1", "", "2"])
540 with pytest.raises(pytest.fail.Exception) as excinfo:
541 lm.fnmatch_lines(["1", "2"], consecutive=True)
542 assert str(excinfo.value).splitlines() == [
543 "exact match: '1'",
544 "no consecutive match: '2'",
545 " with: ''",
546 ]
547
548 lm.re_match_lines(["1", r"\d?", "2"], consecutive=True)
549 with pytest.raises(pytest.fail.Exception) as excinfo:
550 lm.re_match_lines(["1", r"\d", "2"], consecutive=True)
551 assert str(excinfo.value).splitlines() == [
552 "exact match: '1'",
553 r"no consecutive match: '\\d'",
554 " with: ''",
555 ]
556
557
558@pytest.mark.parametrize("function", ["no_fnmatch_line", "no_re_match_line"])

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.95
re_match_linesMethod · 0.95
LineMatcherClass · 0.90

Tested by

no test coverage detected