/src/inbox/ must match src/inbox/ but not x/src/inbox/.
(tmp_path)
| 681 | |
| 682 | |
| 683 | def test_anchored_multi_segment_pattern(tmp_path): |
| 684 | """/src/inbox/ must match src/inbox/ but not x/src/inbox/.""" |
| 685 | from graphify.detect import _is_ignored, _load_graphifyignore |
| 686 | (tmp_path / "src" / "inbox").mkdir(parents=True) |
| 687 | (tmp_path / "x" / "src" / "inbox").mkdir(parents=True) |
| 688 | target_ok = tmp_path / "src" / "inbox" / "a.py" |
| 689 | target_ok.write_text("x=1") |
| 690 | target_bad = tmp_path / "x" / "src" / "inbox" / "b.py" |
| 691 | target_bad.write_text("x=1") |
| 692 | (tmp_path / ".graphifyignore").write_text("/src/inbox/\n") |
| 693 | patterns = _load_graphifyignore(tmp_path) |
| 694 | assert _is_ignored(target_ok, tmp_path, patterns), ( |
| 695 | "src/inbox/a.py must be ignored by /src/inbox/" |
| 696 | ) |
| 697 | assert not _is_ignored(target_bad, tmp_path, patterns), ( |
| 698 | "x/src/inbox/b.py must NOT be ignored by /src/inbox/" |
| 699 | ) |
| 700 | |
| 701 | |
| 702 | # Tests for #1235 - memoise _is_ignored/_eval results via a per-detect() cache |
nothing calls this directly
no test coverage detected