import pathlib


def test_precommit_exists():
    path = pathlib.Path(".pre-commit-config.yaml")
    assert path.exists(), ".pre-commit-config.yaml must exist"

    content = path.read_text(encoding="utf8")
    assert "repos:" in content, "pre-commit config must contain 'repos:'"

    # ensure at least one formatter/linter is referenced
    assert any(x in content for x in ("black", "ruff", "isort")), (
        "pre-commit config must reference at least one of: black, ruff, isort"
    )
