Total Complexity | 3 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 - |
||
2 | |||
3 | """Regression tests. |
||
4 | |||
5 | This file is part of project oemof (github.com/oemof/oemof). It's copyrighted |
||
6 | by the contributors recorded in the version control history of the file, |
||
7 | available from its original location oemof/tests/regression_tests.py |
||
8 | |||
9 | SPDX-License-Identifier: MIT |
||
10 | """ |
||
11 | |||
12 | import logging |
||
13 | |||
14 | import pandas as pd |
||
15 | import pytest |
||
16 | |||
17 | from oemof import solph |
||
18 | from oemof import tools |
||
19 | from oemof.solph._models import LoggingError |
||
20 | |||
21 | |||
22 | def test_version_metadata(): |
||
23 | assert solph.__version__ |
||
24 | |||
25 | |||
26 | def test_wrong_logging_level(): |
||
27 | datetimeindex = pd.date_range("1/1/2012", periods=12, freq="h") |
||
28 | es = solph.EnergySystem(timeindex=datetimeindex, infer_last_interval=True) |
||
29 | tools.logger.define_logging() |
||
30 | my_logger = logging.getLogger() |
||
31 | my_logger.setLevel("DEBUG") |
||
32 | with pytest.raises(LoggingError, match="The root logger level is 'DEBUG'"): |
||
33 | solph.Model(es) |
||
34 | my_logger.setLevel("WARNING") |
||
35 |