Skip to content

Commit

Permalink
Test that date attributes are parsed, not computed
Browse files Browse the repository at this point in the history
Currently failing. I brought this example up in #37.
  • Loading branch information
guoguo12 committed Jul 23, 2018
1 parent ef024c7 commit 8a46ef0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ def test_date_rounding():
assert chart.date == '1996-08-03'


def test_previous_next():
"""Checks that the date, previousDate, and nextDate attributes are parsed
from the HTML, not computed. Specifically, we shouldn't assume charts are
always published seven days apart, since (as this example demonstrates)
this is not true.
"""
chart = billboard.ChartData('hot-100', date='1962-01-06')
assert chart.date == '1962-01-06'
assert chart.previousDate == '1961-12-25'

chart = billboard.ChartData('hot-100', date='1961-12-25')
assert chart.date == '1961-12-25'
assert chart.nextDate == '1962-01-06'


def test_datetime_date():
"""Checks that ChartData correctly handles datetime objects as the
date parameter.
Expand Down

0 comments on commit 8a46ef0

Please sign in to comment.