Skip to content

Commit

Permalink
fix(analysisperiod): fixed end_hour input value check
Browse files Browse the repository at this point in the history
Fixed end_hour input value check

Resolves #109
  • Loading branch information
mostaphaRoudsari authored Mar 3, 2019
2 parents ee68bb9 + 1835d32 commit d028f9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


[![Build Status](https://travis-ci.org/ladybug-tools/ladybug.svg?branch=master)](https://travis-ci.org/ladybug-tools/ladybug)
[![Coverage Status](https://coveralls.io/repos/github/ladybug-tools/ladybug/badge.svg)](https://coveralls.io/github/ladybug-tools/ladybug)
[![Coverage Status](https://coveralls.io/repos/github/ladybug-tools/ladybug/badge.svg?branch=master)](https://coveralls.io/github/ladybug-tools/ladybug)

[![Python 2.7](https://img.shields.io/badge/python-2.7-green.svg)](https://www.python.org/downloads/release/python-270/) [![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/) [![IronPython](https://img.shields.io/badge/ironpython-2.7-red.svg)](https://github.com/IronLanguages/ironpython2/releases/tag/ipy-2.7.8/)

Expand Down
2 changes: 1 addition & 1 deletion ladybug/analysisperiod.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self, st_month=1, st_day=1, st_hour=0, end_month=12,
st_hour = st_hour or 0
end_month = end_month or 12
end_day = end_day or 31
end_hour = end_hour or 23
end_hour = 23 if end_hour is None else end_hour
timestep = timestep or 1
self._is_leap_year = is_leap_year or False

Expand Down
7 changes: 6 additions & 1 deletion tests/analysisperiod_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def test_default_values(self):
assert ap.timestep == 1
assert ap.is_leap_year is False
assert len(ap.datetimes) == 8760
str(ap) # test the string representation

def test_from_string(self):
"""Test creating analysis priod from a string."""
Expand Down Expand Up @@ -163,6 +162,12 @@ def test_duplicate(self):
ap_2 = ap.duplicate()
assert ap_2 == ap

def test_0_end_hour(self):
"""Test hour 0 for end hour."""
params = [1, 1, 1, 1, 2, 0]
ap = AnalysisPeriod(*params)
assert ap.end_hour == 0
assert len(ap) == 24

if __name__ == "__main__":
unittest.main()

0 comments on commit d028f9e

Please sign in to comment.