Skip to content

Commit

Permalink
fixing broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Jun 25, 2024
1 parent c087cbe commit f0cc227
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 54 deletions.
64 changes: 11 additions & 53 deletions grid2op/tests/test_issue_616.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@

from grid2op.Runner import Runner


class Issue616Tester(unittest.TestCase):
def setUp(self):
self.env_name = "l2rpn_case14_sandbox"
# create first env
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
env = grid2op.make(self.env_name,
test=True)
test=True)

# hack for adding maintenance
dict_maint = {
Expand Down Expand Up @@ -133,7 +134,7 @@ def setUp(self):
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
env = grid2op.make(self.env_name,
test=True)
test=True)

# hack for adding maintenance
dict_maint = {
Expand Down Expand Up @@ -165,62 +166,17 @@ def setUp(self):
"gen_p_for_handler": NoisyForecastHandler("prod_p_forecasted"),
"load_p_for_handler": NoisyForecastHandler("load_p_forecasted"),
"load_q_for_handler": NoisyForecastHandler("load_q_forecasted"),
}
},
test=True
)
self.env_bug.chronics_handler.reset()

# store the normal maintenance schedule:
self.maint_ref = (np.array([ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309,
310, 311, 588, 589, 590, 591, 592, 593, 594, 595, 596,
597, 598, 599, 876, 877, 878, 879, 880, 881, 882, 883,
884, 885, 886, 887, 1164, 1165, 1166, 1167, 1168, 1169, 1170,
1171, 1172, 1173, 1174, 1175, 1452, 1453, 1454, 1455, 1456, 1457,
1458, 1459, 1460, 1461, 1462, 1463, 1740, 1741, 1742, 1743, 1744,
1745, 1746, 1747, 1748, 1749, 1750, 1751, 2028, 2029, 2030, 2031,
2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2316, 2317, 2318,
2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2604, 2605,
2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2892,
2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903,
3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190,
3191, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477,
3478, 3479, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764,
3765, 3766, 3767, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051,
4052, 4053, 4054, 4055, 4332, 4333, 4334, 4335, 4336, 4337, 4338,
4339, 4340, 4341, 4342, 4343, 4620, 4621, 4622, 4623, 4624, 4625,
4626, 4627, 4628, 4629, 4630, 4631, 4908, 4909, 4910, 4911, 4912,
4913, 4914, 4915, 4916, 4917, 4918, 4919, 5196, 5197, 5198, 5199,
5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5484, 5485, 5486,
5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5772, 5773,
5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 6060,
6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071,
6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358,
6359, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645,
6646, 6647, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932,
6933, 6934, 6935, 7212, 7213, 7214, 7215, 7216, 7217, 7218, 7219,
7220, 7221, 7222, 7223, 7500, 7501, 7502, 7503, 7504, 7505, 7506,
7507, 7508, 7509, 7510, 7511, 7788, 7789, 7790, 7791, 7792, 7793,
7794, 7795, 7796, 7797, 7798, 7799]),
310, 311]),
np.array([12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14]))
14, 14, 14, 14, 14, 14, 14]))

self.load_p_ref = np.array([[22. , 87. , 45.79999924, 7. , 12. ,
28.20000076, 8.69999981, 3.5 , 5.5 , 12.69999981,
Expand Down Expand Up @@ -266,8 +222,6 @@ def setUp(self):
19.74 , 6.0899997, 2.45 , 3.85 , 8.889999 ,
10.36 ], dtype=np.float32)



def tearDown(self) -> None:
self.env_bug.close()
self.tmp_json.close()
Expand Down Expand Up @@ -360,3 +314,7 @@ def test_chronics_handler_twice_reset(self):
assert (np.abs(maint_ref - maint_1) <= 1e-6).all()
assert (np.abs(load_q_ref - load_q_1) <= 1e-6).all()
assert (np.abs(load_p_ref - load_p_1) <= 1e-6).all()


if __name__ == "__main__":
unittest.main()
1 change: 0 additions & 1 deletion grid2op/tests/test_issue_617.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ def test_can_make_env(self):

if __name__ == "__main__":
unittest.main()

0 comments on commit f0cc227

Please sign in to comment.