• whats wrong with assertion?

Question related to mission The Defenders

 
class Warrior:
    def __init__(self, *args, **kwargs):
        self.health = 50
        self.dmg = 5
        self.defence = 0
        self.is_alive = self.health > 0

class Rookie(Warrior):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.health = 50
        self.dmg = 1

class Knight(Warrior):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.dmg = 7


class Defender(Warrior):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.health = 60
        self.dmg = 3
        self.defence = 2

class Army:
    def __init__(self, *args, **kwargs):
        self.units = []

    def add_units(self, unit_type, unit_number):
        for i in range(unit_number):
            self.units.append(unit_type())


class Battle:
    def __init__(self):
        battle_status = False

    def fight(self, army1, army2):
        battle_status = True
        while battle_status:
            if len(army1.units) > 0 and len(army2.units) > 0:
                if fight(army1.units[0], army2.units[0]):
                    army2.units.pop(0)
                else:
                    army1.units.pop(0)
            elif len(army1.units) == 0:
                return False
            elif len(army2.units) == 0:
                return True


def fight(unit_1, unit_2):

    ans = bool
    damage1 = unit_1.dmg - unit_2.defence
    if damage1 < 0:
        damage1 = 0
    damage2 = unit_2.dmg - unit_1.defence
    if damage2 < 0:
        damage2 = 0
    while unit_1.health > 0 and unit_2.health > 0:

        unit_2.health -= damage1
        if unit_2.health <= 0:
            unit_2.is_alive = False
            ans = True
            break

        unit_1.health -= damage2
        if unit_1.health <= 0:
            ans = False
            unit_1.is_alive = False
            break
    return ans


if __name__ == '__main__':

    unit_1 = Defender()
    unit_2 = Rookie()
    fight(unit_1, unit_2)

    print(unit_1.health)
    print(unit_2.health)

    unit_1 = Knight()
    unit_2 = Rookie()
    fight(unit_1, unit_2)

    print(unit_1.health)
    print(unit_2.health)