Пример #1
0
def test_hero_defend_multi_armour():
    jodie = superheroes.Hero("Jodie Foster")
    gauntlets = superheroes.Armour("Gauntlets", 4000)
    science = superheroes.Armour("Science", 9000)
    jodie.add_armour(gauntlets)
    jodie.add_armour(science)
    defend = jodie.defend()
    assert defend <= 13000 and defend >= 0
Пример #2
0
def create_armour():
    armours = [
        "Calculator", "Laser Shield", "Invisibility", "SFPD Strike Force",
        "Social Workers", "Face Paint", "Damaskus Shield", "Bamboo Wall",
        "Forced Projection", "Thick Fog", "Wall of Will", "Wall of Walls",
        "Obamacare", "Thick Goo"
    ]
    name = armours[random.randint(0, len(armours) - 1)]
    power = random.randint(23, 700000)
    return superheroes.Armour(name, power)
Пример #3
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.Armour("Socks", 10)
    athena.add_armour(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
Пример #4
0
def test_hero_equip_armour():
    jodie = superheroes.Hero("Jodie Foster")
    gauntlets = superheroes.Armour("Gauntlets", 30)
    jodie.add_armour(gauntlets)
    assert len(jodie.armours) == 1
    assert jodie.armours[0].name == "Gauntlets"
Пример #5
0
def test_dead_hero_defence():
    hero = superheroes.Hero("Vlaad", 0)
    garlic = superheroes.Armour("Garlic", 30000)
    hero.add_ability(garlic)
    assert hero.defend() == 0
Пример #6
0
def test_hero_defence():
    jodie = superheroes.Hero("Jodie Foster")
    gauntlets = superheroes.Armour("Gauntlets", 30)
    jodie.add_armour(gauntlets)
    defence = jodie.defend()
    assert defence >= 0 and defence <= 30