def load_text_list(self, deck_list): """ Takes a text file that represents a deck of magic cards. Text file format is: number name IE: 1 Emerakul, The Promised End 4 Grim Flayer and stores it as a deck with a unique entry for each card. :param deck_list: :return: """ self.cards = [] card_list = [] with open(deck_list) as f: for line in f: card_list.append(line) for item in card_list: item_list = item.split() item_number = int(item_list.pop(0)) item_name = ' '.join(item_list) card = get_card(item_name) for _ in range(item_number): self.cards.append(card)
def test_get_type_walking_ballista(self): card_types = ['Artifact', 'Creature'] test_card = get_card('Walking Ballista') test_list = get_types(test_card) self.assertEqual(len(test_list), len(card_types)) self.assertEqual(sorted(test_list), sorted(card_types))
def test_get_card(self): card = get_card('Noxious Gearhulk') self.assertEqual(card.name, 'Noxious Gearhulk')
def test_claim_to_fame(self): card = get_card('claim') self.assertEqual(card.name, 'Claim')
def test_murder(self): card = get_card('Murder') self.assertEqual(card.name, 'Murder')
def test_get_card_walking_ballista(self): test_card = get_card('Walking Ballista') self.assertEqual(test_card.name, 'Walking Ballista')
def test_get_type_lightning_bolt(self): test_card = get_card('Lightning Bolt') self.assertEqual(test_card.type, 'Instant')
def test_get_card_lightning_bolt(self): test_card = get_card('Lightning Bolt') self.assertEqual(test_card.name, 'Lightning Bolt')