#2357 - Allowed the config to not have nodes, links and agents and still be parsed

This commit is contained in:
Chris McCarthy
2024-03-01 22:37:51 +00:00
parent ac304c85a3
commit af036f63f1
3 changed files with 59 additions and 5 deletions

View File

@@ -0,0 +1,19 @@
import yaml
from primaite.game.game import PrimaiteGame
from tests import TEST_ASSETS_ROOT
CONFIG_FILE = TEST_ASSETS_ROOT / "configs" / "no_nodes_links_agents_network.yaml"
def test_no_nodes_links_agents_config():
"""Tests PrimaiteGame can be created from config file where there are no nodes, links, agents in the config file."""
with open(CONFIG_FILE, "r") as f:
cfg = yaml.safe_load(f)
game = PrimaiteGame.from_config(cfg)
network = game.simulation.network
assert len(network.nodes) == 0
assert len(network.links) == 0