Example #1
0
    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)
Example #2
0
    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))
Example #3
0
    def test_get_card(self):
        card = get_card('Noxious Gearhulk')

        self.assertEqual(card.name, 'Noxious Gearhulk')
Example #4
0
    def test_claim_to_fame(self):
        card = get_card('claim')

        self.assertEqual(card.name, 'Claim')
Example #5
0
    def test_murder(self):
        card = get_card('Murder')

        self.assertEqual(card.name, 'Murder')
Example #6
0
    def test_get_card_walking_ballista(self):
        test_card = get_card('Walking Ballista')

        self.assertEqual(test_card.name, 'Walking Ballista')
Example #7
0
    def test_get_type_lightning_bolt(self):
        test_card = get_card('Lightning Bolt')

        self.assertEqual(test_card.type, 'Instant')
Example #8
0
    def test_get_card_lightning_bolt(self):
        test_card = get_card('Lightning Bolt')

        self.assertEqual(test_card.name, 'Lightning Bolt')