def test_is_date_available_week_working_date(self):
        good_date = date(year=1993, month=9, day=26)
        bad_date = date(year=1993, month=9, day=25)
        whs_sunday = {
            6: [(time(hour=9), time(hour=12))],
        }
        availability = {
            'week_working_hours': whs_sunday
        }

        # when other constrains are falsy is_date_available
        # has the same result as is_date_a_week_working_date
        self.assertEqual(is_date_available(good_date, availability),
                         is_date_a_week_working_date(good_date, whs_sunday))
        self.assertEqual(is_date_available(bad_date, availability),
                         is_date_a_week_working_date(bad_date, whs_sunday))
 def test_is_date_available_fixed_closing_date(self):
     d = date(year=1993, month=9, day=26)
     wwh_ok = {
         d.weekday(): [(time(hour=9), time(hour=12))],
     }
     # special_working_hours "wins" over
     # fixed_closing_days and week_working_hours
     assert not is_date_available(d, {
         'fixed_closing_days': [d],
         'week_working_hours': wwh_ok,
     })
 def test_is_date_available_on_empty_availability(self):
     assert not is_date_available(date(year=2016, month=2, day=9), {})