Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterpeere committed Feb 10, 2024
1 parent c520b25 commit 018d7b8
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 31 deletions.
1 change: 0 additions & 1 deletion GHEtool/Validation/sizing_method_comparison_L2_L3_L4.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def compare():

# load the hourly profile
load = HourlyGeothermalLoad()
print(FOLDER)
load.load_hourly_profile(FOLDER.joinpath("Examples/hourly_profile.csv"), header=True, separator=";")
borefield.load = load
borefield.simulation_period = 100
Expand Down
4 changes: 2 additions & 2 deletions GHEtool/VariableClasses/LoadData/_LoadData.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ def UPM(self) -> np.ndarray:
"""
if self.all_months_equal:
# every month has equal length
return np.full(12, _LoadData.AVG_UPM, dtype=np.int32)
return np.full(12, _LoadData.AVG_UPM, dtype=np.int64)
else:
return np.array([744, 672, 744, 720, 744, 720, 744, 744, 720, 744, 720, 744], dtype=np.int32)
return np.array([744, 672, 744, 720, 744, 720, 744, 744, 720, 744, 720, 744], dtype=np.int64)

Check warning on line 121 in GHEtool/VariableClasses/LoadData/_LoadData.py

View check run for this annotation

Codecov / codecov/patch

GHEtool/VariableClasses/LoadData/_LoadData.py#L121

Added line #L121 was not covered by tests

@abc.abstractmethod
def _check_input(self, input: Union[np.ndarray, list, tuple]) -> bool:
Expand Down
16 changes: 0 additions & 16 deletions GHEtool/main_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Borefield(BaseClass):

UPM: float = 730.0 # number of hours per month
THRESHOLD_BOREHOLE_DEPTH: float = 0.05 # threshold for iteration
MAX_SIMULATION_PERIOD: int = 100 # maximal value for simulation

# define default values
DEFAULT_INVESTMENT: list = [35, 0] # 35 EUR/m
Expand Down Expand Up @@ -467,21 +466,6 @@ def set_investment_cost(self, investment_cost: list = None) -> None:
investment_cost = Borefield.DEFAULT_INVESTMENT
self.cost_investment: list = investment_cost

def set_length_peak(self, length: float = DEFAULT_LENGTH_PEAK) -> None:
"""
This function sets the length of the peak.
Parameters
----------
length : float
Length of the peak [hours]
Returns
-------
None
"""
self._borefield_load.peak_duration = length

def set_load(self, load: _LoadData) -> None:
"""
This function sets the _load attribute.
Expand Down
2 changes: 1 addition & 1 deletion GHEtool/test/general_tests/test_GHEtool_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_different_results_with_other_peak_lengths():
borefield.set_max_avg_fluid_temperature(16) # maximum temperature
borefield.set_min_avg_fluid_temperature(0) # minimum temperature

borefield.set_length_peak(2)
borefield.load.peak_duration = 2

Check warning on line 129 in GHEtool/test/general_tests/test_GHEtool_two.py

View check run for this annotation

Codecov / codecov/patch

GHEtool/test/general_tests/test_GHEtool_two.py#L129

Added line #L129 was not covered by tests
init_length_L2 = borefield.size_L2()
borefield.load.peak_duration = 8
new_length_L2 = borefield.size_L2()
Expand Down
11 changes: 0 additions & 11 deletions GHEtool/test/unit-tests/test_main_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,6 @@ def test_load_custom_gfunction():
assert borefield.custom_gfunction == dataset


def test_set_length_peak():
borefield = Borefield()
borefield.load.peak_heating_duration = 8
borefield.load.peak_cooling_duration = 10
assert borefield.load.peak_cooling_duration == 10 * 3600
assert borefield.load.peak_heating_duration == 8 * 3600
borefield.set_length_peak(12)
assert borefield.load.peak_cooling_duration == 12 * 3600
assert borefield.load.peak_heating_duration == 12 * 3600


def test_simulation_period():
borefield = Borefield()
assert borefield.simulation_period == 20
Expand Down

0 comments on commit 018d7b8

Please sign in to comment.