# 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
        sixth_january = self.some_days_of_january.pop(5)
        self.missing_days_of_january.append(sixth_january)
        results = excluded_days(self.all_days_of_january, self.some_days_of_january)
        self.assertEqual(sorted(results), sorted(self.missing_days_of_january))
        self.missing_days_of_january.remove(sixth_january)
        self.some_days_of_january.append(sixth_january)

    def test_all_days_of_returns_all_days_of_an_year(self):
        results = all_days_of(2010, month=None, day=None)
        self.assertEqual(len(results), 365)
        self.assertEqual(results[0], date(2010, 1, 1))
        self.assertEqual(results[-1], date(2010, 12, 31))

    def test_all_days_of_returns_all_days_of_a_month(self):
        results = all_days_of(2014, month=1, day=None)
        self.assertEqual(len(results), 31)
        self.assertEqual(results, self.all_days_of_january)

    def test_all_days_of_year_returns_one_day(self):
        results = all_days_of(2014, month=1, day=1)
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0], self.all_days_of_january[0])

    def test_all_days_handles_current_month(self):
        results = all_days_of(date.today().year, self.today.month)
        first_of_month = date(self.today.year, self.today.month, 1)
        all_days_of_the_month_untill_today = list(daterange(first_of_month, self.today))
        self.assertEqual(results, all_days_of_the_month_untill_today)

    def test_all_days_handles_current_year(self):

# 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

        sixth_january = self.some_days_of_january.pop(5)
        self.missing_days_of_january.append(sixth_january)
        results = excluded_days(self.all_days_of_january, self.some_days_of_january)
        self.assertEqual(sorted(results), sorted(self.missing_days_of_january))
        self.missing_days_of_january.remove(sixth_january)
        self.some_days_of_january.append(sixth_january)

    def test_all_days_of_returns_all_days_of_an_year(self):
        results = all_days_of(2010, month=None, day=None)
        self.assertEqual(len(results), 365)
        self.assertEqual(results[0], date(2010, 1, 1))
        self.assertEqual(results[-1], date(2010, 12, 31))

    def test_all_days_of_returns_all_days_of_a_month(self):
        results = all_days_of(2014, month=1, day=None)
        self.assertEqual(len(results), 31)
        self.assertEqual(results, self.all_days_of_january)

    def test_all_days_of_year_returns_one_day(self):
        results = all_days_of(2014, month=1, day=1)
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0], self.all_days_of_january[0])

    def test_all_days_handles_current_month(self):
        results = all_days_of(date.today().year, self.today.month)
        first_of_month = date(self.today.year, self.today.month, 1)
        all_days_of_the_month_untill_today = list(daterange(first_of_month, self.today))
        self.assertEqual(results, all_days_of_the_month_untill_today)

    def test_all_days_handles_current_year(self):

        results = all_days_of(date.today().year)