def __init__(self, victoryPoints, coasts, earnings, photo): self.__imagePath = photo self.__victoryPoints = int(victoryPoints) self.__coasts = pocket.Pocket() self.__earnings = pocket.Pocket() self.__image = None self.__smal_image = None for i in coasts: self.__coasts.push(coin.Coin(i['name'], int(i['count']))) for i in earnings: self.__earnings.push(coin.Coin(i['name'], int(i['count'])))
def __init__(self, name): self.__name = name self.__victory_points = 0 self.__lords = [] self.__pocket = pocket.Pocket() self.__cards = {} for i in ['diamond', 'emerald', 'sapphire', 'onyx', 'ruby', 'gold']: self.__pocket.push(coin.Coin(i, 0)) self.__cards[i] = []
def __init__(self): self.__decks = {} self.__cards = [[]] self.__coins = pocket.Pocket() self.__coins.push(coin.Coin('gold', GOLD_COINS_START_COUNT)) for i in ['diamond', 'emerald', 'sapphire', 'onyx', 'ruby']: self.__coins.push(coin.Coin(i, DESOR_COINS_START_COUNT)) self.__lords = lord_deck.LordsDeck("cards/LordsList.json") for i in [['low', 'cards/LowCrystalList.json'], ['medium', 'cards/MediumCrystalList.json'], ['high', 'cards/HighCrystalList.json']]: self.__decks[i[0]] = card_deck.CrystalCardDeck(i[1]) self.__decks['lords'] = lord_deck.LordsDeck('cards/LordsList.json') for i in range(4): self.__cards[0].append(self.__lords.getNext()) for i in [['high', 1], ['medium', 2], ['low', 3]]: self.__cards.append([]) for j in range(4): self.__cards[i[1]].append(self.__decks[i[0]].getNext())
def take_coin_by_type(self, type_variable): for i in range(len(self.__pocket)): if str(type_variable) == str(self.__pocket[i].get_type()): return self.__pocket[i] else: return coin.Coin(type_variable, 0)
def test_constructor_1(self): testing_object = coin.Coin('emerald', 3) self.assertEqual(testing_object.get_type(), 'emerald')
def test_str(self): testing_object = coin.Coin('emerald', 4) self.assertEqual(testing_object.__str__(), '4 of emerald')
def test_method_1(self): testing_object = coin.Coin('emerald', 4) self.assertEqual(testing_object.get_count(), 4) testing_object.change_count(3) self.assertEqual(testing_object.get_count(), 7)
def test_constructor_2(self): testing_object = coin.Coin('emerald', 3) self.assertEqual(testing_object.get_count(), 3)