def test_add_ally_and_is_ally(self): name = ["ICE", "AIR", "WATER"] emblem = ["MAMMOTH", "OWL", "OCTOPUS"] ice_kingdom = Kingdom(name[0], emblem[0]) air_kingdom = Kingdom(name[1], emblem[1]) water_kingdom = Kingdom(name[2], emblem[2]) ice_kingdom.add_ally(air_kingdom) self.assertTrue(ice_kingdom.is_ally(air_kingdom)) self.assertTrue(air_kingdom.is_ally(ice_kingdom)) self.assertFalse(water_kingdom.is_ally(ice_kingdom)) Kingdom.remove_all_kingdoms()
def test_ally_count(self): name = ["ICE", "AIR", "WATER"] emblem = ["MAMMOTH", "OWL", "OCTOPUS"] ice_kingdom = Kingdom(name[0], emblem[0]) air_kingdom = Kingdom(name[1], emblem[1]) water_kingdom = Kingdom(name[2], emblem[2]) ice_kingdom.add_ally(air_kingdom) ice_kingdom.add_ally(water_kingdom) self.assertEqual(2, ice_kingdom.total_allies()) self.assertEqual(1, water_kingdom.total_allies()) self.assertNotEqual(2, air_kingdom.total_allies()) Kingdom.remove_all_kingdoms()
def test_check_ruler(self): name = ["ICE", "AIR", "WATER", "FIRE"] emblem = ["MAMMOTH", "OWL", "OCTOPUS", "DRAGON"] ice_kingdom = Kingdom(name[0], emblem[0]) air_kingdom = Kingdom(name[1], emblem[1]) water_kingdom = Kingdom(name[2], emblem[2]) fire_kingdom = Kingdom(name[3], emblem[3]) ice_kingdom.add_ally(air_kingdom) ice_kingdom.add_ally(water_kingdom) ice_kingdom.add_ally(air_kingdom) ice_kingdom.add_ally(fire_kingdom) self.assertTrue(ice_kingdom.is_ruler()) self.assertFalse(fire_kingdom.is_ruler()) Kingdom.remove_all_kingdoms()
def test_get_ruler(self): name = ["ICE", "AIR", "WATER", "FIRE"] emblem = ["MAMMOTH", "OWL", "OCTOPUS", "DRAGON"] ice_kingdom = Kingdom(name[0], emblem[0]) air_kingdom = Kingdom(name[1], emblem[1]) water_kingdom = Kingdom(name[2], emblem[2]) fire_kingdom = Kingdom(name[3], emblem[3]) ice_kingdom.add_ally(air_kingdom) self.assertIsNone(Kingdom.get_ruler()) ice_kingdom.add_ally(water_kingdom) ice_kingdom.add_ally(air_kingdom) ice_kingdom.add_ally(fire_kingdom) self.assertEqual(ice_kingdom, Kingdom.get_ruler()) self.assertNotEqual(fire_kingdom, Kingdom.get_ruler()) Kingdom.remove_all_kingdoms()