Exemple #1
0
def test_team_attack_deaths():
    team_one = superhero.Team("One")
    jodie = superhero.Hero("Jodie Foster")
    aliens = superhero.Ability("Alien Friends", 10000)
    jodie.add_ability(aliens)
    team_one.add_hero(jodie)
    team_two = superhero.Team("Two")
    athena = superhero.Hero("Athena")
    socks = superhero.Armor("Socks", 10)
    athena.add_armor(socks)
    team_two.add_hero(athena)
    assert team_two.heroes[0].deaths == 0
Exemple #2
0
def create_team(heroes=[]):
    teams = [
        "Orchids",
        "Red",
        "Blue",
        "Cheese Steaks",
        "Warriors",
        "49ers",
        "Marvel",
        "DC",
        "Rat Pack",
        "The Little Red Riding Hoods",
        "Team One",
        "Generic Team",
        "X-men",
        "Team Two",
        "Golden Champions",
        "Vegan Protectors",
        "The Cardinals",
        "Winky Bears",
        "Steelsmiths",
        "Boilermakers",
        "Nincompoops"]

    name = teams[random.randint(0, len(teams) - 1)]
    team = superhero.Team(name)
    if len(heroes) > 0:
        for member in heroes:
            team.add_hero(member)

    return team
Exemple #3
0
def test_team_remove_unlisted():
    # Test that if no results found return 0
    team = superhero.Team("One")
    jodie = superhero.Hero("Jodie Foster")
    team.add_hero(jodie)
    code = team.remove_hero("Athena")
    assert code == 0
Exemple #4
0
def test_team_remove_hero():
    team = superhero.Team("One")
    jodie = superhero.Hero("Jodie Foster")
    team.add_hero(jodie)
    assert team.heroes[0].name == "Jodie Foster"
    team.remove_hero(jodie)
    assert len(team.heroes) == 0
def test_team_attack():
    team_one = superhero.Team("One")
    jodie = superhero.Hero("Jodie Foster")
    aliens = superhero.Ability("Alien Friends", 10000)
    jodie.add_ability(aliens)
    team_one.add_hero(jodie)
    team_two = superhero.Team("Two")
    athena = superhero.Hero("Athena")
    socks = superhero.Armor("Socks", 10)
    athena.add_armor(socks)
    team_two.add_hero(athena)
    assert team_two.heros[0].current_health == 100

    team_one.attack(team_two)

    assert team_two.heros[0].current_health <= 0
Exemple #6
0
def test_print_heroes():
    team = superhero.Team("One")
    jodie = superhero.Hero("Jodie Foster")
    team.add_hero(jodie)
    athena = superhero.Hero("Athena")
    team.add_hero(athena)
    output_string = capture_console_output(team.view_all_heroes)

    assert "Jodie Foster" in output_string
    assert "Athena" in output_string
Exemple #7
0
def test_revive_heroes():
    heroes = []
    for _ in range(0, 20):
        heroes.append(build_hero(4, 4, 4))

    team_one = superhero.Team("One")
    for hero in heroes:
        team_one.add_hero(hero)

    for hero in team_one.heroes:
        hero.current_health == 12
    team_one.revive_heroes()

    for hero in team_one.heroes:
        assert hero.current_health == 100
Exemple #8
0
def test_team_remove_empty_list():
    team = superhero.Team("One")
    assert team.remove_hero("Athena") == 0
Exemple #9
0
def test_team_name():
    team = superhero.Team("One")
    assert team.name == "One"
Exemple #10
0
def test_team_instance():
    team = superhero.Team("One")
    assert team