Ejemplo n.º 1
0
def test_team_attack_deaths():
    team_one = superheroes.Team("One")
    jodie = superheroes.Hero("Jodie Foster")
    aliens = superheroes.Ability("Alien Friends", 10000)
    jodie.add_ability(aliens)
    team_one.add_hero(jodie)
    team_two = superheroes.Team("Two")
    athena = superheroes.Hero("Athena")
    socks = superheroes.Armor("Socks", 10)
    athena.add_armor(socks)
    team_two.add_hero(athena)
    assert team_two.members[0].deaths == 0
    team_two.kill_team()
    assert team_two.members[0].deaths == 1
Ejemplo n.º 2
0
def test_team_remove_unlisted():
    # Test that if no results found return 0
    team = superheroes.Team("One")
    jodie = superheroes.Hero("Jodie Foster")
    team.add_hero(jodie)
    code = team.remove_hero("Athena")
    assert code == 0
Ejemplo n.º 3
0
def test_print_heroes():
    team = superheroes.Team("One")
    jodie = superheroes.Hero("Jodie Foster")
    team.add_hero(jodie)
    athena = superheroes.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
Ejemplo n.º 4
0
def test_team_remove_hero():
    team = superheroes.Team("One")
    jodie = superheroes.Hero("Jodie Foster")
    team.add_hero(jodie)
    jade = superheroes.Hero("Jade Marry")
    team.add_hero(jade)
    jane = superheroes.Hero("Jane Pots")
    team.add_hero(jane)
    print("there are still {} members in the team".format(len(team.members)))
    assert team.members[0].name == "Jodie Foster"
    team.remove_hero("Jodie Foster")
    assert len(
        team.members) == 2, "there are still {} members in the team".format(
            len(team.members))
Ejemplo n.º 5
0
def test_revive_heroes():
    hero = []
    for _ in range(0, 20):
        hero.append(build_hero(4, 4, 4))

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

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

    for hero in team_one.members:
        assert hero.current_health == 100
Ejemplo n.º 6
0
def create_team(hero=[]):
    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 = superheroes.Team(name)
    if len(hero) > 0:
        for member in hero:
            team.add_hero(member)

    return team
Ejemplo n.º 7
0
def test_team_remove_empty_list():
    team = superheroes.Team("One")
    assert team.remove_hero("Athena") == 0
Ejemplo n.º 8
0
def test_team_hero():
    team = superheroes.Team("One")
    jodie = superheroes.Hero("Jodie Foster")
    team.add_hero(jodie)
    assert len(team.members) == 1
    assert team.members[0].name == "Jodie Foster"
Ejemplo n.º 9
0
def test_team_name():
    team = superheroes.Team("One")
    assert team.name == "One"
Ejemplo n.º 10
0
def test_team_instance():
    team = superheroes.Team("One")
    assert team