Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

Commit

Permalink
add more descriptive error on assert
Browse files Browse the repository at this point in the history
  • Loading branch information
czue committed Jan 5, 2015
1 parent 1e0f327 commit a7188b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dimagi/utils/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def months_between(start, end):
the year and month of the start date, and the last one being
the year and month of the end date.
"""
assert datetime.date(start.year, start.month, 1) <= datetime.date(end.year, end.month, 1)
assert datetime.date(start.year, start.month, 1) <= datetime.date(end.year, end.month, 1), \
'start date {} was later than end date {}!'.format(start, end)
months = []
date_type = type(start)
while start <= end:
Expand Down

0 comments on commit a7188b1

Please sign in to comment.