def test_from_human(self): working_hours = WeeklyInterval('Mon', time(9, 00), 'Fri', time(17, 0)) assert WeeklyInterval.from_human('Mon@9am - Fri@5pm') == working_hours assert WeeklyInterval.from_human('Monday 9:00 - Friday@17:00') == working_hours assert WeeklyInterval.from_human('Mon@9:00-Fri@17:00') == working_hours assert not WeeklyInterval.from_human('Mon@9:00-Tue@17:00') == working_hours
def test_from_human_with_timezone(self): working_hours = WeeklyInterval('Mon', time(9, 00), 'Fri', time(17, 0)) # During summer time now = pendulum.datetime(2019, 8, 30, tz='Europe/London') set_test_now(now) assert WeeklyInterval.from_human( "Mon 10:00 Europe/London - Fri 18:00 Europe/London" ) == working_hours # Outside summer time now = pendulum.datetime(2019, 12, 30, tz='Europe/London') set_test_now(now) assert WeeklyInterval.from_human( "Mon 09:00 Europe/London - Fri 17:00 Europe/London" ) == working_hours