Skip to content

Commit

Permalink
Debug: Fixed Accidental Rename of 'name' to 'ep_id'
Browse files Browse the repository at this point in the history
  • Loading branch information
DEUCE1957 committed Mar 12, 2024
1 parent f523785 commit 290ca42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions grid2op/tests/test_EpisodeData.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def act(self, observation, reward, done=False):

# test that the right seeds are assigned to the agent
res = runner.run(nb_episode=1, max_iter=self.max_iter, path_save=f)
episode_data = EpisodeData.from_disk(agent_path=f, ep_id=res[0][1])
episode_data = EpisodeData.from_disk(agent_path=f, name=res[0][1])
assert int(episode_data.meta["chronics_max_timestep"]) == self.max_iter
assert len(episode_data.actions) == self.max_iter
assert len(episode_data.observations) == self.max_iter + 1
Expand All @@ -148,7 +148,7 @@ def test_one_episode_with_saving(self):
timestep,
max_ts
) = self.runner.run_one_episode(path_save=f)
episode_data = EpisodeData.from_disk(agent_path=f, ep_id=episode_name)
episode_data = EpisodeData.from_disk(agent_path=f, name=episode_name)
assert int(episode_data.meta["chronics_max_timestep"]) == self.max_iter
assert len(episode_data.other_rewards) == self.max_iter
for other, real in zip(episode_data.other_rewards, episode_data.rewards):
Expand Down Expand Up @@ -191,14 +191,14 @@ def test_len(self):
timestep,
max_ts
) = self.runner.run_one_episode(path_save=f)
episode_data = EpisodeData.from_disk(agent_path=f, ep_id=episode_name)
episode_data = EpisodeData.from_disk(agent_path=f, name=episode_name)
len(episode_data)

def test_3_episode_with_saving(self):
f = tempfile.mkdtemp()
res = self.runner._run_sequential(nb_episode=3, path_save=f)
for i, episode_name, cum_reward, timestep, total_ts in res:
episode_data = EpisodeData.from_disk(agent_path=f, ep_id=episode_name)
episode_data = EpisodeData.from_disk(agent_path=f, name=episode_name)
assert int(episode_data.meta["chronics_max_timestep"]) == self.max_iter
assert (
np.abs(
Expand All @@ -215,7 +215,7 @@ def test_3_episode_3process_with_saving(self):
)
assert len(res) == nb_episode
for i, episode_name, cum_reward, timestep, total_ts in res:
episode_data = EpisodeData.from_disk(agent_path=f, ep_id=episode_name)
episode_data = EpisodeData.from_disk(agent_path=f, name=episode_name)
assert int(episode_data.meta["chronics_max_timestep"]) == self.max_iter
assert (
np.abs(
Expand Down Expand Up @@ -263,7 +263,7 @@ def test_with_opponent(self):
path_save=f,
)

episode_data = EpisodeData.from_disk(agent_path=f, ep_id=res[0][1])
episode_data = EpisodeData.from_disk(agent_path=f, name=res[0][1])
lines_impacted, subs_impacted = episode_data.attacks[0].get_topological_impact()
assert lines_impacted[3]

Expand Down

0 comments on commit 290ca42

Please sign in to comment.