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_a_week_working_date_with_a_compatible_date(self): assert is_date_a_week_working_date( date(year=1993, month=9, day=26), { 6: [(time(hour=9), time(hour=12))], } )
def test_is_date_a_week_working_date_with_an_incompatible_date(self): assert not is_date_a_week_working_date( date(year=1990, month=10, day=3), { 0: [(time(hour=9), time(hour=12))], 1: [(time(hour=23), time(hour=2))], 3: [(time(hour=8), time(hour=9))], 6: [(time(hour=3), time(hour=5))], } )