from pathlib import Path import sys SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from compute_distribution import ( # noqa: E402 Candidate, allocate_capacity_envelope, node_count_range, summarize_source_classes, ) def test_hyperscale_equivalent_requires_12500_to_30000_nodes(): assert node_count_range( low_mw=250, high_mw=300, min_node_kw=10, max_node_kw=20, ) == (12500, 30000) def test_candidate_without_all_three_gates_receives_no_eligible_capacity(): result = allocate_capacity_envelope( total_mw=250, candidates=[ Candidate( candidate_id="feedlot-1", heat_host_verified=True, grid_capacity_verified=False, compute_demand_verified=True, capacity_limit_mw=1, ) ], ) assert result.eligible_mw == 0 assert result.unallocated_mw == 250 def test_source_class_summary_separates_seed_from_conditional_ceiling(): summary = summarize_source_classes( source_kinds=["npdes", "npdes", "feedlot"], seed_node_kw=15, low_mw=250, high_mw=300, ).set_index("source_kind") assert summary.loc["npdes", "locations"] == 2 assert summary.loc["npdes", "seed_capacity_mw"] == 0.03 assert summary.loc["feedlot", "conditional_share_low_mw"] == 250 / 3 assert summary["eligible_capacity_mw"].sum() == 0