Skip to content

Commit

Permalink
fix(runperiod): Remove unnecessary "start before end" check
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Jul 17, 2021
1 parent 4e21969 commit 3f5c78e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
17 changes: 2 additions & 15 deletions honeybee_energy/simulation/runperiod.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ class RunPeriod(object):
"""EnergyPlus Simulation Run Period.
Args:
start_date: A ladybug Date object for the start of the run period.
Must be before the end date and have a leap_year property matching the
end_date. Default: 1 Jan
end_date: A ladybug Date object for the end of the run period.
Must be after the start date and have a leap_year property matching the
start_date. Default: 31 Dec
start_date: A ladybug Date for the start of the run period. (Default: 1 Jan)
end_date: A ladybug Date for the end of the run period. (Default: 31 Dec)
start_day_of_week: Text for the day of the week on which the simulation
starts. Default: 'Sunday'. Choose from the following:
Expand Down Expand Up @@ -78,7 +74,6 @@ def start_date(self, value):
self._start_date = value
else:
self._start_date = Date(1, 1)
self._check_start_before_end()

@property
def end_date(self):
Expand All @@ -92,7 +87,6 @@ def end_date(self, value):
self._end_date = value
else:
self._end_date = Date(12, 31)
self._check_start_before_end()

@property
def start_day_of_week(self):
Expand Down Expand Up @@ -372,13 +366,6 @@ def duplicate(self):
"""Get a copy of this object."""
return self.__copy__()

def _check_start_before_end(self):
"""Check that the start_date is before the end_date."""
assert self.start_date.leap_year is self.end_date.leap_year, \
'RunPeriod start_date.leap_year must match the end_date.leap_year'
assert self._start_date <= self._end_date, 'RunPeriod start_date must come ' \
'before end_date. {} comes after {}.'.format(self.start_date, self.end_date)

@staticmethod
def _check_date(date, date_name='date'):
assert isinstance(date, Date), 'Expected ladybug Date for ' \
Expand Down
4 changes: 0 additions & 4 deletions tests/simulation_runperiod_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ def test_run_period_setability():
assert run_period.holidays == (Date(1, 1), Date(3, 17))
run_period.daylight_saving_time = DaylightSavingTime()
assert run_period.daylight_saving_time == DaylightSavingTime()
with pytest.raises(AssertionError):
run_period.start_date = Date(11, 10)
with pytest.raises(AssertionError):
run_period.start_date = Date(3, 10, True)
run_period.is_leap_year = True
assert run_period.is_leap_year

Expand Down

0 comments on commit 3f5c78e

Please sign in to comment.