def test_init_should_raise_type_error_if_hero_or_enemy_not_of_their_type(
            self):
        map_ = Dungeon('level1.txt')
        hero = Hero(name="Bron",
                    title="Dragonslayer",
                    health=100,
                    mana=100,
                    mana_regeneration_rate=2)
        enemy = "enemy"

        exc = None
        try:
            Fight(hero, enemy, level_map=map_.level_map)
        except Exception as e:
            exc = e

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'Invalid type.')

        hero = "hero"
        enemy = Enemy(health=100, mana=20, damage=20)

        exc = None
        try:
            Fight(hero, enemy, level_map=map_.level_map)
        except Exception as e:
            exc = e

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'Invalid type.')
    def test_instantiating_enemy_with_negative_damage_should_raise_error(self):

        exc = None

        try:
            Enemy(health=100, mana=100, damage=-20)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'Damage should be positive integer')
    def test_instantiating_enemy_with_wrong_type_mana_should_raise_error(self):

        exc = None

        try:
            Enemy(health=100, mana='asd', damage=20)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'Mana should be positive integer')
    def test_init_fight_should_save_hero_and_enemy(self):
        map_ = Dungeon('level1.txt')
        hero = Hero(name="Bron",
                    title="Dragonslayer",
                    health=100,
                    mana=100,
                    mana_regeneration_rate=2)
        weapon = Weapon('Axe', 20)
        spell = Spell('Fireball', 20, 50, 2)
        hero.equip(weapon)
        hero.learn(spell)
        enemy = Enemy(health=100, mana=20, damage=20)

        fight = Fight(hero, enemy, level_map=map_.level_map)

        self.assertEqual((hero, enemy), (fight.hero, fight.enemy))