from __future__ import annotations

import importlib.util
import sys
from pathlib import Path

HERE = Path(__file__).parent
SPEC = importlib.util.spec_from_file_location(
    "observer_v2_binding", HERE / "observer_v2.py"
)
assert SPEC and SPEC.loader
m = importlib.util.module_from_spec(SPEC)
sys.modules[SPEC.name] = m
SPEC.loader.exec_module(m)


def test_external_binding_verifies_candidate_parity_and_editable_runtime():
    m.verify_binding()


def test_wrapper_binds_observer_to_current_source_runtime():
    observer = m.load_observer()
    assert observer.SUCCESSOR == m.SUCCESSOR
    assert observer.CORE == m.CORE
    assert observer.WHEEL == m.WHEEL
    assert observer.SITE == m.SOURCE
