def test__date_range(self):
        # minutes, seconds and hours should be capped at 300, 480, and 720
        d = datetime(2014, 1, 1)
        self.assertEqual(len(list(self.r._date_range('seconds', d))), 300)
        self.assertEqual(len(list(self.r._date_range('minutes', d))), 480)
        self.assertEqual(len(list(self.r._date_range('hourly', d))), 720)

        # Everything else should have a timedelta of 7 days
        self.assertEqual(len(list(self.r._date_range('daily', None))), 8)
        self.assertEqual(len(list(self.r._date_range('weekly', None))), 8)
        self.assertEqual(len(list(self.r._date_range('monthly', None))), 8)
        self.assertEqual(len(list(self.r._date_range('yearly', None))), 8)

        # Test with a specified `to` argument.
        since = datetime(2014, 1, 1)
        to = datetime(2015, 1, 1)
        self.assertEqual(len(list(self.r._date_range('daily', since, to))), 366)
        self.assertEqual(len(list(self.r._date_range('weekly', since, to))), 366)
        self.assertEqual(len(list(self.r._date_range('monthly', since, to))), 366)
        self.assertEqual(len(list(self.r._date_range('yearly', since, to))), 366)
Tests ``R._date_range`` at various granularities *without* a
dataset/ETHPy150Open bradmontgomery/django-redis-metrics/redis_metrics/tests/test_models.py/TestR.test__date_range