whatif.py: add --remove for teardown/demolish scenarios
Mirrors --add - removes AMOUNT (default: all) of a building from the copied spec. Used this to check whether BHP's HWP is still worth running after its price drop (still +19.8k-28.4k/day marginal, nowhere near a teardown call) without hand-writing two spec files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,18 @@ def test_apply_add_appends_new_building_with_recipe():
|
||||
assert spec["buildings"] == [{"building": "CHP", "amount": 1, "recipes": ["MG,S,CU=>IND"]}]
|
||||
|
||||
|
||||
def test_apply_remove_drops_building_entirely_by_default():
|
||||
spec = {"buildings": [{"building": "HWP", "amount": 1, "recipes": ["AL,STL,HE=>BHP"]}]}
|
||||
whatif.apply_remove(spec, "HWP")
|
||||
assert spec["buildings"] == []
|
||||
|
||||
|
||||
def test_apply_remove_partial_amount():
|
||||
spec = {"buildings": [{"building": "CHP", "amount": 3, "recipes": ["MG,S,CU=>IND"]}]}
|
||||
whatif.apply_remove(spec, "CHP:1")
|
||||
assert spec["buildings"] == [{"building": "CHP", "amount": 2, "recipes": ["MG,S,CU=>IND"]}]
|
||||
|
||||
|
||||
def test_apply_infra_adds_delta():
|
||||
spec = {"infrastructure": {"HB1": 4}}
|
||||
whatif.apply_infra(spec, "HB1:+1,HB2:+2")
|
||||
|
||||
Reference in New Issue
Block a user