def __init__(self, request: Request): super().__init__(request) self.category: str = request.matchdict.get("category") self.time_span: str = request.matchdict.get("time_span") self.dubbed: str = request.matchdict.get("dubbed") self.location: str = request.matchdict.get("location") self.time_span_options: Dict = get_time_span_options(self.time_span) self.shows: List = [] self.day: str = "" self.no_more_shows_today = False
def __init__(self, request: Request): super().__init__(request) self.category: str = "alle" self.time_span: str = "heute" self.dubbed: str = "nein" self.location: str = "alle" self.time_span_options: Dict = get_time_span_options(self.time_span) self.shows: List = shows.get_shows( time_span=self.time_span, category=self.category, dubbed=self.dubbed, location=self.location, ) self.day: str = shows.get_day(self.shows) if not self.shows: self.no_more_shows_today: bool = True else: self.no_more_shows_today: bool = False
def test_get_time_span_options_returns_right_length(): # WHEN a valid option is already present result = timespans.get_time_span_options("heute") # THEN six remaining options should be given assert len(result) == 6
def test_get_time_span_options_returns_correct_order(): # WHEN the option is a specific day result = timespans.get_time_span_options("freitag") # THEN the first two options should be heute and morgen assert list(islice(result, 2)) == ["heute", "morgen"]
def test_get_time_span_options_returns_right_length_2(): # WHEN not a valid option is present (in reality day name for today) result = timespans.get_time_span_options("whenever") # THEN seven options should be returned assert len(result) == 7