"""test_dis_local_vs_global.py""" from __future__ import annotations import pytest from dis_local_vs_global import global_scope, local_scope, main, opnames def test_local_uses_load_fast() -> None: ops = opnames(local_scope) assert any(op.startswith("LOAD_FAST") for op in ops) assert "LOAD_GLOBAL" not in ops def test_global_uses_load_global() -> None: ops = opnames(global_scope) assert "LOAD_GLOBAL" in ops def test_main_runs(capsys: pytest.CaptureFixture[str]) -> None: main() out = capsys.readouterr().out assert "local: " in out assert "global_ns:" in out