Пример #1
0
def test_team_attack_deaths():
    team_one = superduel.Team("One")
    jodie = superduel.Hero("Jodie Foster")
    aliens = superduel.Ability("Alien Friends", 10000)
    jodie.add_ability(aliens)
    team_one.add_hero(jodie)
    team_two = superduel.Team("Two")
    athena = superduel.Hero("Athena")
    socks = superduel.Armor("Socks", 10)
    athena.add_armor(socks)
    team_two.add_hero(athena)
    assert team_two.heroes[0].deaths == 0
    team_one.attack(team_two)
    assert team_two.heroes[0].deaths == 1
Пример #2
0
def test_team_remove_unlisted():
    # Test that if no results found return 0
    team = superduel.Team("One")
    jodie = superduel.Hero("Jodie Foster")
    team.add_hero(jodie)
    code = team.remove_hero("Athena")
    assert code == 0
Пример #3
0
def test_team_remove_hero():
    team = superduel.Team("One")
    jodie = superduel.Hero("Jodie Foster")
    team.add_hero(jodie)
    assert team.heroes[0].name == "Jodie Foster"
    team.remove_hero("Jodie Foster")
    assert len(team.heroes) == 0
Пример #4
0
def test_print_heroes():
    team = superduel.Team("One")
    jodie = superduel.Hero("Jodie Foster")
    team.add_hero(jodie)
    athena = superduel.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
Пример #5
0
def test_revive_heroes():
    heroes = []
    for _ in range(0, 20):
        heroes.append(build_hero(4, 4, 4))

    team_one = superduel.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
Пример #6
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 = superduel.Team(name)
    if len(heroes) > 0:
        for member in heroes:
            team.add_hero(member)

    return team
Пример #7
0
def test_team_remove_empty_list():
    team = superduel.Team("One")
    assert team.remove_hero("Athena") == 0
Пример #8
0
def test_team_name():
    team = superduel.Team("One")
    assert team.name == "One"
Пример #9
0
def test_team_instance():
    team = superduel.Team("One")
    assert team