#2845: Pre-commit fixes

This commit is contained in:
Nick Todd
2024-09-03 17:24:21 +01:00
parent 61add769c4
commit 1822e85eec

View File

@@ -1,10 +1,13 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
import json
from primaite.session.environment import PrimaiteGymEnv from primaite.session.environment import PrimaiteGymEnv
from primaite.session.io import PrimaiteIO from primaite.session.io import PrimaiteIO
import json
from tests import TEST_ASSETS_ROOT from tests import TEST_ASSETS_ROOT
DATA_MANIPULATION_CONFIG = TEST_ASSETS_ROOT / "configs" / "data_manipulation.yaml" DATA_MANIPULATION_CONFIG = TEST_ASSETS_ROOT / "configs" / "data_manipulation.yaml"
def test_obs_data_in_log_file(): def test_obs_data_in_log_file():
"""Create a log file of AgentHistoryItems and check observation data is """Create a log file of AgentHistoryItems and check observation data is
included. Assumes that data_manipulation.yaml has an agent labelled included. Assumes that data_manipulation.yaml has an agent labelled
@@ -19,7 +22,7 @@ def test_obs_data_in_log_file():
env.reset() env.reset()
io = PrimaiteIO() io = PrimaiteIO()
path = io.generate_agent_actions_save_path(episode=1) path = io.generate_agent_actions_save_path(episode=1)
with open(path, 'r') as f: with open(path, "r") as f:
j = json.load(f) j = json.load(f)
assert type(j['0']['defender']['obs_space_data']) == dict assert type(j["0"]["defender"]["obs_space_data"]) == dict