def test_season_name() -> None: assert rotation.season_name(1) == 'Season 1' found = False try: rotation.season_name(999) except DoesNotExistException: found = True assert found found = False try: assert rotation.season_name('ISD') except DoesNotExistException: found = True assert found assert rotation.season_name('EMN') == 'Season 1' assert rotation.season_name('emn') == 'Season 1' assert rotation.season_name('HOU') == 'Season 5' assert rotation.season_name('hou') == 'Season 5' assert rotation.season_name('ALL') == 'All Time' assert rotation.season_name('all') == 'All Time'
def all_seasons(self) -> List[SeasonInfoDescription]: seasons: List[SeasonInfoDescription] = [{ 'name': 'All Time', 'code': 'all', 'code_lower': 'all', 'num': None, 'url': seasonized_url('all'), 'decks_url': url_for('seasons.season', season_id='all'), 'league_decks_url': url_for('seasons.season', season_id='all', deck_type='league'), 'competitions_url': url_for('seasons.competitions', season_id='all'), 'archetypes_url': url_for('seasons.archetypes', season_id='all'), 'people_url': url_for('seasons.people', season_id='all'), 'cards_url': url_for('seasons.cards', season_id='all'), 'rotation_changes_url': url_for('seasons.rotation_changes', season_id='all') }] num = 1 next_rotation_set_code = rotation.next_rotation_ex()['code'] for code in rotation.SEASONS: if code == next_rotation_set_code: break seasons.append({ 'name': rotation.season_name(num), 'code': code, 'code_lower': code.lower(), 'num': num, 'url': seasonized_url(num), 'decks_url': url_for('seasons.season', season_id=num), 'league_decks_url': url_for('seasons.season', season_id=num, deck_type='league'), 'competitions_url': url_for('seasons.competitions', season_id=num), 'archetypes_url': url_for('seasons.archetypes', season_id=num), 'people_url': url_for('seasons.people', season_id=num), 'cards_url': url_for('seasons.cards', season_id=num), 'rotation_changes_url': url_for('seasons.rotation_changes', season_id=num) }) num += 1 seasons.reverse() return seasons
def all_seasons(self) -> List[SeasonInfoDescription]: seasons: List[SeasonInfoDescription] = [{ 'name': 'All Time', 'code': 'all', 'code_lower': 'all', 'num': None, 'url': seasonized_url('all'), 'decks_url': url_for('seasons.decks', season_id='all'), 'league_decks_url': url_for('seasons.decks', season_id='all', deck_type=DeckType.LEAGUE.value), 'competitions_url': url_for('seasons.competitions', season_id='all'), 'archetypes_url': url_for('seasons.archetypes', season_id='all'), 'people_url': url_for('seasons.people', season_id='all'), 'cards_url': url_for('seasons.cards', season_id='all'), 'rotation_changes_url': url_for('seasons.rotation_changes', season_id='all'), 'tournament_leaderboards_url': url_for('seasons.tournament_leaderboards', season_id='all'), 'legal_cards_url': None }] num = 1 next_rotation_set_code = rotation.next_rotation_ex().code for code in rotation.SEASONS: if code == next_rotation_set_code: break seasons.append({ 'name': rotation.season_name(num), 'code': code, 'code_lower': code.lower(), 'num': num, 'url': seasonized_url(num), 'decks_url': url_for('seasons.decks', season_id=num), 'league_decks_url': url_for('seasons.decks', season_id=num, deck_type=DeckType.LEAGUE.value), 'competitions_url': url_for('seasons.competitions', season_id=num), 'archetypes_url': url_for('seasons.archetypes', season_id=num), 'people_url': url_for('seasons.people', season_id=num), 'cards_url': url_for('seasons.cards', season_id=num), 'rotation_changes_url': url_for('seasons.rotation_changes', season_id=num), 'tournament_leaderboards_url': url_for('seasons.tournament_leaderboards', season_id=num), 'legal_cards_url': f'https://pdmtgo.com/{code}_legal_cards.txt' }) num += 1 seasons.reverse() return seasons
def season_name(self) -> str: return rotation.season_name(get_season_id())
def page_title(self): return rotation.season_name(self.season.number)