def get_period_list(self): if self.data_set.period_type.lower() == 'weekly': year = int(str(self.period)[0:4]) month = int(str(self.period)[4:]) weeks = utils.month_to_weeks(year, month) period_list = utils.create_period_list(year, weeks) else: period_list = self.period return period_list
def test_convert_weeks_to_period_list(self): weeks = utils.month_to_weeks(2016, 12) period_list = utils.create_period_list(2016, weeks) self.assertEqual(period_list, "2016W49,2016W50,2016W51,2016W52")