Skip to content

Commit 6b66c6d

Browse files
author
chrwm
committed
Update unit test
1 parent d9cccb3 commit 6b66c6d

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed
-3.08 KB
Binary file not shown.
-5.44 KB
Binary file not shown.

tests/test_scripts.py

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,46 @@
11
import pandas as pd
2+
from pandas.testing import assert_frame_equal
23

3-
from scripts.sedos_structure_parser import parse_es_structure
4+
from scripts.sedos_structure_parser import parse_es_structure, read_sedos_bwshare_excel
45

56

67
def test_parse_es_structure():
7-
expected_output = pd.read_excel(r"test_data\test_structures\SEDOS_es_structure.xlsx")
8+
data = {
9+
"parameter": ["ACT_BND", "ACT_COST", "FLO_EFF", "default", "default", "default", "default"],
10+
"process": [
11+
"ind_cement_rk_ccs_1",
12+
"ind_cement_rk_ccs_1",
13+
"ind_cement_rk_ccs_1",
14+
"pow_combustion_gt",
15+
"pow_combustion_gt_SNG",
16+
"pow_combustion_gt_biogas",
17+
"pow_combustion_gt_natgas",
18+
],
19+
"input": [
20+
"coal,coke,coke_oven_gas,heavy_fuel_oil,natgas,hydrogen,SNG,,biomass,waste,sludge,elec,"
21+
"cement_rawmeal_mats",
22+
"coal,coke,coke_oven_gas,heavy_fuel_oil,natgas,hydrogen,SNG,,biomass,"
23+
"waste,sludge,elec,cement_rawmeal_mats",
24+
"coal,coke,coke_oven_gas,heavy_fuel_oil,natgas,hydrogen,SNG,,biomass,waste,sludge,elec,cement_rawmeal_mats",
25+
"biogas,natgas,SNG_ren,SNG_conv,hydrogen_ren,hydrogen_conv,heating_oil",
26+
"SNG_ren,SNG_conv",
27+
"biogas",
28+
"natgas",
29+
],
30+
"output": [
31+
"cement_clinker_mats,CO2p,CO2f,CH4f,N2Of",
32+
"cement_clinker_mats,CO2p,CO2f,CH4f,N2Of",
33+
"cement_clinker_mats,CO2p,CO2f,CH4f,N2Of",
34+
"elec_ren,elec_conv,CO2",
35+
"elec_ren,elec_conv,CO2",
36+
"elec_ren",
37+
"elec_conv,CO2",
38+
],
39+
}
40+
expected_output = pd.DataFrame(data)
841

9-
print(expected_output.parameter)
10-
parse_es_structure(
11-
file_path=r"test_data\test_structures\SEDOS_Prozesse&Parameter.xlsx",
12-
output_path=r"test_data\test_structures\SEDOS_es_structure_test_output.xlsx",
42+
function_df = parse_es_structure(
43+
sedos_es_dict=read_sedos_bwshare_excel("test_data/test_structures/SEDOS_Prozesse&Parameter.xlsx")
1344
)
1445

15-
func_output = pd.read_excel(r"test_data\test_structures\SEDOS_es_structure_test_output.xlsx")
16-
17-
assert expected_output == func_output
46+
assert_frame_equal(expected_output, function_df)

0 commit comments

Comments
 (0)