Issues (108)

tests/test_tsam_processing.py (1 issue)

Severity
1
# -*- coding: utf-8 -*-
2
3
import pandas as pd
4
5
from oemof.solph import processing
6
7
8
def test_disaggregate_timeindex():
9
    ti_1 = pd.date_range("2020-01-01", periods=10, freq="h")
10
    ti_2 = pd.date_range("2030-01-01", periods=20, freq="h")
11
    ti_3 = pd.date_range("2040-01-01", periods=40, freq="h")
12
    ti = ti_1.union(ti_2).union(ti_3)
13
14
    periods = [ti_1, ti_2, ti_3]
15
    tsa_parameters = [
16
        {"timesteps_per_period": 5, "order": [1, 0]},
17
        {"timesteps_per_period": 5, "order": [1, 0, 0, 1]},
18
        {"timesteps_per_period": 10, "order": [1, 0, 0, 1]},
19
    ]
20
21
    for p, period_data in enumerate(tsa_parameters):
22
        if p == 0:
23
            result_index = processing._disaggregate_tsa_timeindex(
24
                periods[p], period_data
25
            )
26
        else:
27
            result_index = result_index.union(
0 ignored issues
show
The variable result_index does not seem to be defined in case the for loop on line 21 is not entered. Are you sure this can never be the case?
Loading history...
28
                processing._disaggregate_tsa_timeindex(periods[p], period_data)
29
            )
30
31
    assert all(result_index == ti)
32