# Path: console/utils.py
# def all_days_of(year, month=None, day=None):
#         res = []
#         if day and month:
#             res.append(date(year, month, day))
#         elif month:
#             today = date.today()
#             if year == today.year and month == today.month:
#                 last_day = today.day
#             else:
#                 last_day = monthrange(year, month)[1]
# 
#             for d in xrange(last_day):
#                 res.extend(all_days_of(year, month, d+1))
#         else:
#             today = date.today()
# 
#             last_month = 12 if year != today.year else today.month
# 
#             for m in xrange(1, last_month+1):
#                 res.extend(all_days_of(year, m))
#         return res
# 
# def excluded_days(all_days, days_to_exclude):
#     return diff(all_days, days_to_exclude)
# 
# def daterange(start_date, end_date):
#     for n in xrange((end_date - start_date).days + 1):
#         yield start_date + timedelta(n)


import unittest
from datetime import date
from django.utils.six.moves import xrange
from console.utils import all_days_of, excluded_days, daterange




class TestUtils(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        start = date(2014, 1, 1)
        end = date(2014, 1, 31)
        cls.all_days_of_january = list(daterange(start, end))
        end = date(2014, 1, 30)

# Path: console/utils.py
# def all_days_of(year, month=None, day=None):
#         res = []
#         if day and month:
#             res.append(date(year, month, day))
#         elif month:
#             today = date.today()
#             if year == today.year and month == today.month:
#                 last_day = today.day
#             else:
#                 last_day = monthrange(year, month)[1]
# 
#             for d in xrange(last_day):
#                 res.extend(all_days_of(year, month, d+1))
#         else:
#             today = date.today()
# 
#             last_month = 12 if year != today.year else today.month
# 
#             for m in xrange(1, last_month+1):
#                 res.extend(all_days_of(year, m))
#         return res
# 
# def excluded_days(all_days, days_to_exclude):
#     return diff(all_days, days_to_exclude)
# 
# def daterange(start_date, end_date):
#     for n in xrange((end_date - start_date).days + 1):
#         yield start_date + timedelta(n)


# Path: console/tests/test_utils.py
import unittest
from datetime import date
from django.utils.six.moves import xrange
from console.utils import all_days_of, excluded_days, daterange





class TestUtils(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        start = date(2014, 1, 1)
        end = date(2014, 1, 31)
        cls.all_days_of_january = list(daterange(start, end))
        end = date(2014, 1, 30)

        cls.some_days_of_january = list(daterange(start, end))