MCPcopy
hub / github.com/pytest-dev/pytest / test_linematcher_consecutive

Function test_linematcher_consecutive

testing/test_pytester.py:528–545  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

526
527
528def test_linematcher_consecutive() -> None:
529 lm = LineMatcher(["1", "", "2"])
530 with pytest.raises(pytest.fail.Exception) as excinfo:
531 lm.fnmatch_lines(["1", "2"], consecutive=True)
532 assert str(excinfo.value).splitlines() == [
533 "exact match: '1'",
534 "no consecutive match: '2'",
535 " with: ''",
536 ]
537
538 lm.re_match_lines(["1", r"\d?", "2"], consecutive=True)
539 with pytest.raises(pytest.fail.Exception) as excinfo:
540 lm.re_match_lines(["1", r"\d", "2"], consecutive=True)
541 assert str(excinfo.value).splitlines() == [
542 "exact match: '1'",
543 r"no consecutive match: '\\d'",
544 " with: ''",
545 ]
546
547
548@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