Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann committed Dec 19, 2018
1 parent d6775d0 commit 3f0675b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
8 changes: 1 addition & 7 deletions energy_demand/basic/basic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
import os
import shutil
from collections import defaultdict
import numpy as np
from pyproj import Proj, transform

Expand Down Expand Up @@ -33,7 +32,6 @@ def get_result_paths(scenario_run_results):

return path_dict


def get_weather_result_paths(weather_path):
"""Joins results subfolders to ``weather_path`` and returns a dict
Expand Down Expand Up @@ -183,7 +181,6 @@ def get_long_lat_decimal_degrees(reg_centroids):

return reg_coord


def rmse(predictions, actual_values):
"""Root-mean-square deviation or
Root-mean-square-erro (RMSE) calculations
Expand All @@ -210,9 +207,7 @@ def rmse(predictions, actual_values):
rms = sqrt(mean_squared_error(y_actual, y_predicted))
"""
rmse = np.sqrt(((predictions - actual_values) ** 2).mean())

return rmse
return np.sqrt(((predictions - actual_values) ** 2).mean())

def array_to_dict(result_array, regions):
"""Convert an array with regions to dict
Expand Down Expand Up @@ -279,7 +274,6 @@ def del_previous_results(path_folder, path_subfolder_keep):
Path of subfolder which must not be deleted
"""
if os.path.exists(path_folder):

all_files_and_folders = os.listdir(path_folder)

# Iterate folders in data folders
Expand Down
8 changes: 4 additions & 4 deletions tests/assumptions/test_base_assumptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from energy_demand.assumptions import general_assumptions
from energy_demand.read_write import data_loader


def test_load_non_param_assump(config_file):
def test_load_non_param_assump():
"""
"""
config_file = "C:/Users/cenv0553/ED/energy_demand/local_run_config_file.ini"
config = data_loader.read_config_file(config_file)

# Load data
Expand All @@ -28,10 +28,10 @@ def test_load_non_param_assump(config_file):
enduses=enduses,
sectors=sectors)


def test_load_param_assump(config_file):
def test_load_param_assump():
"""
"""
config_file = "C:/Users/cenv0553/ED/energy_demand/local_run_config_file.ini"
config = data_loader.read_config_file(config_file)

# Load data
Expand Down
18 changes: 5 additions & 13 deletions tests/test_enduse_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,8 @@ def test_apply_service_switch():
all_technologies = ['boilerA', 'boilerB']

annual_tech_diff_params = {
'test_enduse': {
'test_sector': {
'boilerA': {2050: share_boilerA_cy},
'boilerB': {2050: share_boilerB_cy}
}
}}
'boilerA': {curr_yr: share_boilerA_cy},
'boilerB': {curr_yr: share_boilerB_cy}}

crit_switch_happening = {'test_enduse': ['test_sector']}

Expand All @@ -155,14 +151,10 @@ def test_apply_service_switch():

share_boilerA_cy = 0.99
share_boilerB_cy = 0.01

annual_tech_diff_params = {
'test_enduse': {
'test_sector': {
'boilerA': {2050: share_boilerA_cy},
'boilerB': {2050: share_boilerB_cy}
}
}}
'boilerA': {curr_yr: share_boilerA_cy},
'boilerB': {curr_yr: share_boilerB_cy}}

result = enduse_func.apply_service_switch(
enduse='test_enduse',
Expand Down

0 comments on commit 3f0675b

Please sign in to comment.