Skip to content

Commit

Permalink
Adding metrics testing
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmaloney committed Sep 10, 2020
1 parent 93696bf commit c30227b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_core_two_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
thermostat_furnace_or_boiler_two_stage_none_single_stage,
thermostat_heat_pump_electric_backup_two_stage_heat_pump_two_stage,
metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data,
core_heating_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire,
core_cooling_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire,
)


Expand All @@ -39,3 +41,25 @@ def test_thermostat_furnace_or_boiler_two_stage_none_single_stage(thermostat_fur
with pytest.raises(ValueError):
core_cooling_day_sets = thermostat_furnace_or_boiler_two_stage_none_single_stage.get_core_cooling_days(
method="year_end_to_end")

@pytest.fixture(params=range(2))
def core_days(request, thermostat_heat_pump_electric_backup_two_stage_heat_pump_two_stage, core_heating_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire,
core_cooling_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire):

tests = [
(thermostat_heat_pump_electric_backup_two_stage_heat_pump_two_stage, core_cooling_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire, 0, "cooling"),
(thermostat_heat_pump_electric_backup_two_stage_heat_pump_two_stage, core_heating_day_set_heat_pump_electric_backup_two_stage_heat_pump_two_stage_entire, 1, "heating"),
]

return tests[request.param]


def test_day_counts(core_days, metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data):
thermostat, core_day_set, i, heating_or_cooling = core_days
n_both, n_days_insufficient = thermostat.get_ignored_days(core_day_set)
n_core_days = thermostat.get_core_day_set_n_days(core_day_set)
n_days_in_inputfile_date_range = thermostat.get_inputfile_date_range(core_day_set)
assert n_both == metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data[i]["n_days_both_heating_and_cooling"]
assert n_days_insufficient == metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data[i]["n_days_insufficient_data"]
assert n_core_days == metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data[i]["n_core_{}_days".format(heating_or_cooling)]
assert n_days_in_inputfile_date_range == metrics_heat_pump_electric_backup_two_stage_heat_pump_two_stage_data[i]["n_days_in_inputfile_date_range"]

0 comments on commit c30227b

Please sign in to comment.