forked from OSeMOSYS/osemosys2iamc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_resultify.py
31 lines (24 loc) · 1.31 KB
/
test_resultify.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
import pandas as pd
import os
from .resultify import filter_fuel
class TestFilter:
def test_filter_fuel(self):
filepath = os.path.join("tests", 'fixtures', "UseByTechnology.csv")
input_data = pd.read_csv(filepath)
technologies = ['ALUPLANT']
fuels = ['C1_P_HCO']
actual = filter_fuel(input_data, technologies, fuels)
data = [
['Globe', 'ID', 'ALUPLANT', 'C1_P_HCO', 2010, 0.399179303],
['Globe', 'ID', 'ALUPLANT', 'C1_P_HCO', 2011, 0.397804018],
['Globe', 'ID', 'ALUPLANT', 'C1_P_HCO', 2012, 0.390495285],
['Globe', 'IN', 'ALUPLANT', 'C1_P_HCO', 2010, 0.399179303],
['Globe', 'IN', 'ALUPLANT', 'C1_P_HCO', 2011, 0.397804018],
['Globe', 'IN', 'ALUPLANT', 'C1_P_HCO', 2012, 0.390495285],
['Globe', 'IP', 'ALUPLANT', 'C1_P_HCO', 2010, 0.029739228],
['Globe', 'IP', 'ALUPLANT', 'C1_P_HCO', 2011, 0.029739228],
['Globe', 'IP', 'ALUPLANT', 'C1_P_HCO', 2012, 0.07106111],
]
expected = pd.DataFrame(data=data, columns=['REGION', 'TIMESLICE', 'TECHNOLOGY', 'FUEL', 'YEAR', 'VALUE'])
index = ['REGION', 'TIMESLICE', 'TECHNOLOGY', 'FUEL', 'YEAR']
pd.testing.assert_frame_equal(actual.set_index(index), expected.set_index(index), check_index_type=False)