def test_with_date(self): "Returns when using a date, not a datetime." d = datetime_from_str('2016-10-01 00:00:00').date() scrobbles = ditto_lastfm.day_scrobbles(date=d) self.assertEqual(len(scrobbles), 3) self.assertEqual(scrobbles[0], self.scrobble1) self.assertEqual(scrobbles[1], self.scrobble2) self.assertEqual(scrobbles[2], self.scrobble4)
def test_for_one_accounts(self): "Only returns scrobbles for one account on requested date." scrobbles = ditto_lastfm.day_scrobbles( account=self.account1, date=datetime_from_str('2016-10-01 00:00:00')) self.assertEqual(len(scrobbles), 2) self.assertEqual(scrobbles[0], self.scrobble1) self.assertEqual(scrobbles[1], self.scrobble2)
def test_for_all_accounts(self): "Returns ALL scrobbles from requested date." scrobbles = ditto_lastfm.day_scrobbles( datetime_from_str('2016-10-01 00:00:00')) self.assertEqual(len(scrobbles), 3) self.assertEqual(scrobbles[0], self.scrobble1) self.assertEqual(scrobbles[1], self.scrobble2) self.assertEqual(scrobbles[2], self.scrobble4)
def test_account_error(self): "Should raise TypeError if invalid Account is supplied." with self.assertRaises(TypeError): ditto_lastfm.day_scrobbles(account='bob')
def test_date_error(self): "Should raise TypeError if invalid date is supplied." with self.assertRaises(TypeError): ditto_lastfm.day_scrobbles(date='bob')
def test_date_error(self): "Should raise ValueError if no date is supplied." with self.assertRaises(ValueError): ditto_lastfm.day_scrobbles()