|
21 | 21 | dea_sheet_names, |
22 | 22 | geometric_series, |
23 | 23 | get_data_from_DEA, |
| 24 | + get_dea_vehicle_data, |
24 | 25 | get_excel_sheets, |
25 | 26 | get_sheet_location, |
| 27 | + rename_pypsa_old, |
26 | 28 | set_round_trip_efficiency, |
27 | 29 | set_specify_assumptions, |
28 | 30 | ) |
@@ -736,3 +738,44 @@ def test_add_carbon_capture(config): |
736 | 738 | index=["2020", "source", "unit", "further description"], |
737 | 739 | ) |
738 | 740 | ) |
| 741 | + |
| 742 | + |
| 743 | +def test_get_dea_vehicle_data(config): |
| 744 | + """ |
| 745 | + The test verifies what is returned by get_dea_vehicle_data. |
| 746 | + """ |
| 747 | + df = get_dea_vehicle_data( |
| 748 | + snakemake_input_dictionary["dea_vehicles"], ["2020"], pd.DataFrame() |
| 749 | + ) |
| 750 | + assert df.shape == (90, 5) |
| 751 | + assert sorted(list(df.columns)) == sorted( |
| 752 | + ["2020", "unit", "source", "currency_year", "further description"] |
| 753 | + ) |
| 754 | + |
| 755 | + |
| 756 | +def test_rename_pypsa_old(): |
| 757 | + """ |
| 758 | + The test verifies what is returned by rename_pypsa_old. |
| 759 | + """ |
| 760 | + data = { |
| 761 | + ("decentral water tank storage", "investment"): [46.8], |
| 762 | + ("central CHP", "investment"): [3000], |
| 763 | + ("hydrogen underground storage", "investment"): [2000], |
| 764 | + ("retrofitting I", "investment"): [1000], |
| 765 | + ("retrofitting II", "investment"): [1500], |
| 766 | + } |
| 767 | + index = pd.MultiIndex.from_tuples(data.keys()) |
| 768 | + cost_dataframe_pypsa = pd.DataFrame(data.values(), index=index, columns=["value"]) |
| 769 | + expected_data = { |
| 770 | + ("decentral water tank storage", "investment"): [1.0], |
| 771 | + ("central gas CHP", "investment"): [3000], |
| 772 | + ("hydrogen storage underground", "investment"): [2000], |
| 773 | + } |
| 774 | + expected_index = pd.MultiIndex.from_tuples(expected_data.keys()) |
| 775 | + expected_df = pd.DataFrame( |
| 776 | + expected_data.values(), index=expected_index, columns=["value"] |
| 777 | + ) |
| 778 | + expected_df.loc[("decentral water tank storage", "investment"), "unit"] = "EUR/kWh" |
| 779 | + output_df = rename_pypsa_old(cost_dataframe_pypsa) |
| 780 | + comparison_df = output_df.compare(expected_df) |
| 781 | + assert comparison_df.empty |
0 commit comments