Skip to content

Commit 7f0e900

Browse files
committed
fix broken tests
Signed-off-by: DONNOT Benjamin <[email protected]>
1 parent dc3ac6c commit 7f0e900

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

grid2op/Space/GridObjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class GridObjects:
483483
"""
484484

485485
BEFORE_COMPAT_VERSION : ClassVar[str] = "neurips_2020_compat"
486-
MIN_VERSION_DETACH : ClassVar[str] = version.parse("1.11.0.dev2")
486+
MIN_VERSION_DETACH : ClassVar[str] = version.parse("1.11.0.dev0")
487487
glop_version : ClassVar[str] = GRID2OP_CURRENT_VERSION_STR
488488

489489
_INIT_GRID_CLS = None # do not modify that, this is handled by grid2op automatically

grid2op/tests/test_Observation.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,28 @@ def setUp(self):
685685
0,
686686
0,
687687
],
688+
"timestep_protection_engaged": [
689+
0,
690+
0,
691+
0,
692+
0,
693+
0,
694+
0,
695+
0,
696+
0,
697+
0,
698+
0,
699+
0,
700+
0,
701+
0,
702+
0,
703+
0,
704+
0,
705+
0,
706+
0,
707+
0,
708+
0,
709+
],
688710
"time_before_cooldown_sub": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
689711
"time_next_maintenance": [
690712
-1,
@@ -934,6 +956,8 @@ def setUp(self):
934956
# dt_float,
935957
# dt_float,
936958
# dt_float,
959+
# timestep_protection_engaged
960+
dt_int
937961
],
938962
dtype=object,
939963
)
@@ -1012,9 +1036,11 @@ def setUp(self):
10121036
# 11,
10131037
# 5,
10141038
# 0,
1039+
# timestep_protection_engaged
1040+
20
10151041
]
10161042
)
1017-
self.size_obs = 429 + 4 + 4 + 2 + 1 + 10 + 5 + 0 + 5 # + 11 + 5 + 0 + 11 + 11 + 5
1043+
self.size_obs = 429 + 4 + 4 + 2 + 1 + 10 + 5 + 0 + 5 + 20
10181044

10191045
def tearDown(self):
10201046
self.env.close()

grid2op/tests/test_attached_envs.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def test_action_space(self):
183183
def test_observation_space(self):
184184
assert issubclass(self.env.observation_space.subtype, CompleteObservation)
185185
# size_th = 467
186-
size_th = 473 # gen_delta
186+
# size_th = 473 # gen_delta
187+
size_th = 473 + 20 # n_line added for timestep_protection_engaged
187188
assert self.env.observation_space.n == size_th, (
188189
f"obs space size is {self.env.observation_space.n}," f"should be {size_th}"
189190
)
@@ -223,11 +224,12 @@ def test_opponent(self):
223224

224225
def test_action_space(self):
225226
assert issubclass(self.env.action_space.subtype, PlayableAction)
226-
assert self.env.action_space.n == 166, f"{self.env.action_space.n} instead of 166"
227+
# 183 and not 166 because detachment automatically added in the Playable action
228+
assert self.env.action_space.n == 183, f"{self.env.action_space.n} instead of 183"
227229

228230
def test_observation_space(self):
229231
assert issubclass(self.env.observation_space.subtype, CompleteObservation)
230-
size_th = 518
232+
size_th = 518 + 20 # n_line added for timestep_protection_engaged
231233
assert self.env.observation_space.n == size_th, (
232234
f"obs space size is {self.env.observation_space.n}," f"should be {size_th}"
233235
)
@@ -272,7 +274,7 @@ def test_action_space(self):
272274
def test_observation_space(self):
273275
assert issubclass(self.env.observation_space.subtype, CompleteObservation)
274276
# size_th = 467
275-
size_th = 473 # gen_p_delta
277+
size_th = 473 + 20 # n_line added for timestep_protection_engaged
276278
assert self.env.observation_space.n == size_th, (
277279
f"obs space size is {self.env.observation_space.n}," f"should be {size_th}"
278280
)
@@ -317,7 +319,7 @@ def test_action_space(self):
317319
def test_observation_space(self):
318320
assert issubclass(self.env.observation_space.subtype, CompleteObservation)
319321
# size_th = 475
320-
size_th = 481 # gen_p_delta
322+
size_th = 481 + 20 # n_line added for timestep_protection_engaged
321323
assert self.env.observation_space.n == size_th, (
322324
f"obs space size is {self.env.observation_space.n}," f"should be {size_th}"
323325
)

0 commit comments

Comments
 (0)