"""Pin: ``mgf.fed.__version__`` MUST match ``pyproject.toml`` (AP-13).

Drift is otherwise silent until tag time — a release wheel could ship a
``__version__`` that disagrees with the package metadata. Asserting it here
shifts the catch to every push/PR.
"""

from __future__ import annotations

import tomllib
from pathlib import Path

import mgf.fed


def test_dunder_version_matches_pyproject() -> None:
    pyproject = Path(__file__).resolve().parent.parent.parent / "pyproject.toml"
    declared = tomllib.loads(pyproject.read_text(encoding="utf-8"))["project"]["version"]
    assert mgf.fed.__version__ == declared, (
        f"AP-13 version drift: mgf.fed.__version__={mgf.fed.__version__!r} "
        f"pyproject={declared!r}. Update both in the same commit when bumping a release."
    )
