Skip to content

Commit c10f376

Browse files
committed
fix wrong key name in test
Signed-off-by: DONNOT Benjamin <[email protected]>
1 parent a985a8e commit c10f376

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

grid2op/tests/BaseRedispTest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def test_redispacth_secondabovepmax(self):
331331

332332
act = self.env.action_space({"redispatch": [(2, 40.0)]})
333333
obs, reward, done, info = self.env.step(act)
334-
assert not info["failed_redisp"]
334+
assert not info["failed_redispatching"]
335335
assert np.all(obs.target_dispatch == np.array([0.0, 0.0, 60.0, 0.0, 0.0]))
336336
th_disp = np.array([0.0, -23.5, 50.4, 0.0, -26.900002])
337337
th_disp = np.array([0., -12.977809, 50.40005, 0., -37.42224 ])
@@ -469,7 +469,7 @@ def test_redispatch_generator_off(self):
469469
redispatch_act = self.env.action_space({"redispatch": [(1, 5.0)]})
470470
obs, reward, done, info = self.env.step(redispatch_act)
471471

472-
assert info["failed_redisp"] == True
472+
assert info["failed_redispatching"] == True
473473

474474

475475
class BaseTestRedispTooLowHigh(MakeBackend):
@@ -513,12 +513,12 @@ def test_redisp_toohigh_toolow(self):
513513
act = self.env.action_space({"redispatch": (0, -1)})
514514
obs, reward, done, info = self.env.step(act)
515515
assert not done
516-
assert not info["failed_redisp"]
516+
assert not info["failed_redispatching"]
517517
assert np.all(self.env._target_dispatch == [-1.0, 0.0, 0.0, 0.0, 0.0])
518518
act = self.env.action_space({"redispatch": (0, 0)})
519519
obs, reward, done, info = self.env.step(act)
520520
assert not done
521-
assert not info["failed_redisp"]
521+
assert not info["failed_redispatching"]
522522
assert np.all(self.env._target_dispatch == [-1.0, 0.0, 0.0, 0.0, 0.0])
523523

524524
# this one is not correct: too high decrease
@@ -527,7 +527,7 @@ def test_redisp_toohigh_toolow(self):
527527
)
528528
obs, reward, done, info = self.env.step(act)
529529
assert not done
530-
assert info["failed_redisp"]
530+
assert info["failed_redispatching"]
531531
assert np.all(self.env._target_dispatch == [-1.0, 0.0, 0.0, 0.0, 0.0])
532532

533533
# this one is not correct: too high increase
@@ -536,7 +536,7 @@ def test_redisp_toohigh_toolow(self):
536536
)
537537
obs, reward, done, info = self.env.step(act)
538538
assert not done
539-
assert info["failed_redisp"]
539+
assert info["failed_redispatching"]
540540
assert np.all(self.env._target_dispatch == [-1.0, 0.0, 0.0, 0.0, 0.0])
541541

542542
def test_error_message_notzerosum_oneshot(self):
@@ -551,22 +551,22 @@ def test_error_message_notzerosum_oneshot(self):
551551
}
552552
)
553553
obs, reward, done, info = self.env.step(act)
554-
assert info["failed_redisp"]
554+
assert info["failed_redispatching"]
555555
assert info["exception"][0].__str__()[:140] == self.msg_
556556

557557
def test_error_message_notzerosum_threesteps(self):
558558
self.skipTest("Ok with new redispatching implementation")
559559
act = self.env.action_space({"redispatch": [(0, 4.9999784936326535)]})
560560
obs, reward, done, info = self.env.step(act)
561-
assert info["failed_redisp"] is False
561+
assert info["failed_redispatching"] is False
562562

563563
act = self.env.action_space({"redispatch": [(1, 4.78524395611872)]})
564564
obs, reward, done, info = self.env.step(act)
565-
assert info["failed_redisp"] is False
565+
assert info["failed_redispatching"] is False
566566

567567
act = self.env.action_space({"redispatch": [(4, -9.999591852954794)]})
568568
obs, reward, done, info = self.env.step(act)
569-
assert info["failed_redisp"]
569+
assert info["failed_redispatching"]
570570
assert info["exception"][0].__str__()[:140] == self.msg_
571571

572572

grid2op/tests/test_issue_367.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_action(self):
4141
act.redispatch = [(gen_id, -3.5)]
4242
obs, reward, done, info = self.env.step(act)
4343
assert not done
44-
assert not info['failed_redisp']
44+
assert not info['failed_redispatching']
4545
assert obs.target_dispatch[gen_id] == -3.5, f"should be -3.5, but is {obs.target_dispatch[gen_id]:.2f}"
4646

4747
act = self.env.action_space()
@@ -54,7 +54,7 @@ def test_action(self):
5454
act.redispatch = [(gen_id, +1.5)]
5555
obs, reward, done, info = self.env.step(act)
5656
assert not done
57-
assert not info['failed_redisp']
57+
assert not info['failed_redispatching']
5858
assert abs(obs.target_dispatch[gen_id] - 1.5) <= 1e-2, f"should be 1.5, but is {obs.target_dispatch[gen_id]:.2f}"
5959

6060
def tearDown(self) -> None:

0 commit comments

Comments
 (0)