Esempio n. 1
0
def test_unit_attack_exception():
    soldier = Unit('Soldier', 0, 20)
    warrior = Unit('Warrior', 100, 20)

    with pytest.raises(UnitIsDeadException):
        soldier.attack(warrior)

    with pytest.raises(UnitIsDeadException):
        soldier.counter_attack(warrior)

    with pytest.raises(UnitIsDeadException):
        soldier.take_damage(warrior.damage)
Esempio n. 2
0
def test_damage_greater_than_hp():
    soldier = Unit('Soldier', 20, 20)

    soldier.take_damage(30)
    assert soldier.hp == 0