Ejemplo n.º 1
0
def main(team_name, roster):
    """Retrieves a given roster from the Blaseball API and parses it for writing to the team's Blasebal Wiki navigation box."""

    team_name = team
    # Load team from blaseball-mike
    team_obj = Team.load_by_name(team_name)
    change_level = roster
    # Turn team.id into the correct wiki nav page
    nav = id_to_nav(team_obj.id)
    # if nav = None something something error?
    # Wikitextify the team.lineup list for navbox use
    new_roster = textify(team_obj, change_level)
    # Edit the wiki using nav, --roster (change_level), and textify (new_roster)
    wiki_edit(nav, change_level, new_roster)
Ejemplo n.º 2
0
def set_team_from_string(re_match, group_name, sample):
    if group_name in re_match.groupdict() and re_match.group(
            group_name) is not None:
        team_name = re_match.group(group_name)
        if team_name == 'Dalé':
            team_name = 'Dale'
        elif team_name == 'Pies':  # blaseball-mike cannot tell the Pies and Spies apart
            team_name = 'Philly Pies'

        team = Team.load_by_name(team_name)

        if team is not None:
            sample.set_arg('Player1Team', f'[[{team.full_name}]]')
        else:
            print('Did not use team from string')
Ejemplo n.º 3
0
 def test_load_by_name_bad_name(self):
     bad_name = Team.load_by_name("Ohio Astronauts")
     assert bad_name is None
Ejemplo n.º 4
0
 def test_load_by_name(self):
     team = Team.load_by_name("Boston Flowers")
     assert isinstance(team, Team)