Exemple #1
0
 def test_uhhh(self):
     """Checks that nextDate raises an AttributeError when there are no more
     charts. For example, if 2017 is the last chart then it should raise an
     AttributeError since there is not an 2018 chart yet.
     """
     chart = billboard.YearEnd('hot-100-songs')
     chart = billboard.YearEnd('hot-100-songs', chart.nextDate)
Exemple #2
0
    def test_date_rounding(self):
        """Checks that the we are rounding dates correctly: it should
        round up to the nearest date on which a chart was published.
        """
        chart = billboard.YearEnd('hot-100-songs', date='1000')
        self.assertEqual(chart.date,
                         '2006')  # The first year end hot 100 songs chart

        chart = billboard.YearEnd('hot-100-songs', date='2006')
        self.assertEqual(chart.date, '2006')
Exemple #3
0
    def test_previous_next(self):
        """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.YearEnd('hot-100-songs', date='2007')
        self.assertEqual(chart.date, '2007')
        self.assertEqual(chart.previousDate, '2006')

        chart = billboard.YearEnd('hot-100-songs', date='2007')
        self.assertEqual(chart.date, '2007')
        self.assertEqual(chart.nextDate, '2008')
Exemple #4
0
 def test_datetime_date(self):
     """Checks that YearEnd correctly handles datetime objects as the
     date parameter.
     """
     chart = billboard.YearEnd('hot-100-songs', datetime.date(2015, 7, 9))
     self.assertEqual(len(chart), 100)
     self.assertEqual(chart.date, '2015')
 def setUp(self):
     self.chart = billboard.YearEnd('hot-100-songs', date='2015')
 def setUp(self):
     self.chart = billboard.YearEnd('hot-100-songs')
Exemple #7
0
 def test_empty_string_date(self):
     """
     Checks that passing an empty string as the date raises an exception.
     """
     billboard.YearEnd('hot-100-songs', date='')
Exemple #8
0
 def test_unsupported_date_format(self):
     """Checks that using an unsupported date format raises an exception."""
     billboard.YearEnd('hot-100-songs', date='07-30-1996')
 def setUp(self):
     self.chart = billboard.YearEnd('top-artists', date='2015')
 def setUp(self):
     self.chart = billboard.YearEnd('top-artists')
def test_timeout():
    """Checks that using a very small timeout prevents connection."""
    billboard.YearEnd('hot-100-songs', timeout=1e-9)
def test_non_existent_chart():
    """Checks that requesting a non-existent chart fails."""
    billboard.YearEnd('does-not-exist')