/
test_issue_369.py
50 lines (40 loc) · 1.86 KB
/
test_issue_369.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (c) 2019-2022, RTE (https://www.rte-france.com)
# See AUTHORS.txt and https://github.com/rte-france/Grid2Op/pull/319
# This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
# If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of Grid2Op, Grid2Op a testbed platform to model sequential decision making in power systems.
import pdb
import grid2op
import unittest
import warnings
import re
from grid2op.Chronics import MultifolderWithCache
from grid2op.tests.helper_path_test import *
class Issue367Tester(unittest.TestCase):
def setUp(self) -> None:
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
# Creation of the environment
self.env = grid2op.make("l2rpn_wcci_2022_dev",
chronics_class=MultifolderWithCache,
_add_to_name=type(self).__name__,
test=True) # No bug wihout the MultifolderWithCache argument here
self.env.chronics_handler.real_data.set_filter(lambda x: re.match(".*2050-02-14_0", x) is not None) # We test on a randomly chosen chronic for the example
self.env.chronics_handler.reset()
self.env.set_id(0)
self.env.seed(0)
param = self.env.parameters
param.NO_OVERFLOW_DISCONNECTION = True
self.env.change_parameters(param)
self.obs = self.env.reset()
def test_date(self):
assert self.obs.year == 2050
assert self.obs.month == 2
assert self.obs.day == 14
def tearDown(self) -> None:
self.env.close()
return super().tearDown()
if __name__ == "__main__":
unittest.main()