Exemple #1
0
class WhenExtractingSingleCardWithManySets(object):
    def setup(self):
        self.extractor = CardExtractor(card_html("blazing_torch"))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_extract_all_sets(self):
        eq_(self.card.printings, [("Zendikar", "Uncommon"), ("Innistrad", "Common")])
class WhenExtractingSingleCardWithManySets(object):
    def setup(self):
        self.extractor = CardExtractor(card_html('blazing_torch'))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_extract_all_sets(self):
        eq_(self.card.printings, [('Zendikar', 'Uncommon'),
                                  ('Innistrad', 'Common')])
Exemple #3
0
class WhenExtractingSingleCardWithManySets(object):

    def setup(self):
        self.extractor = CardExtractor(card_html('blazing_torch'))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_extract_all_sets(self):
        eq_(self.card.printings,
            [('Zendikar', 'Uncommon'), ('Innistrad', 'Common')])
Exemple #4
0
class WhenExtractingSingleCreature(object):
    def setup(self):
        self.ex = CardExtractor(card_html("personal_incarnation"))
        self.extracted = self.ex.extract()
        self.card = self.extracted[0]

    def should_extract_power(self):
        eq_(self.card.power, "6")

    def should_extract_toughness(self):
        eq_(self.card.toughness, "6")
class WhenExtractingSingleCreature(object):
    def setup(self):
        self.ex = CardExtractor(card_html('personal_incarnation'))
        self.extracted = self.ex.extract()
        self.card = self.extracted[0]

    def should_extract_power(self):
        eq_(self.card.power, '6')

    def should_extract_toughness(self):
        eq_(self.card.toughness, '6')
Exemple #6
0
class WhenExtractingSingleCard(object):
    def setup(self):
        self.extractor = CardExtractor(card_html("acorn_harvest"))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_get_one_result(self):
        eq_(len(self.extracted), 1)

    def should_extract_name(self):
        assert self.card.name == "Acorn Harvest"

    def should_extract_mana_cost(self):
        eq_(self.card.mana_cost, "3G")

    def should_extract_types(self):
        eq_(self.card.types, ["Sorcery"])

    def should_extract_text(self):
        eq_(
            self.card.rules_text,
            u"Put two 1/1 green Squirrel creature "
            u"tokens onto the battlefield. ; Flashback—{1}{G}, Pay 3 life."
            u" (You may cast this card from your graveyard for its flashback "
            u"cost. Then exile it.)",
        )

    def should_not_extract_rarity(self):
        assert not hasattr(self.card, "rarity")

    def should_extract_expansion(self):
        assert not hasattr(self.card, "expansion")

    def should_extract_artist(self):
        eq_(self.card.artist, "Edward P. Beard, Jr.")

    def should_extract_converted_mana_cost(self):
        eq_(self.card.converted_mana_cost, "4")

    def should_extract_collector_number(self):
        eq_(self.card.collector_number, "118")

    def should_extract_expansion(self):
        eq_(self.card.printings, [("Torment", "Common")])

    def should_extract_community_rating(self):
        eq_(self.card.community_rating, "3.330")

    def should_extract_community_votes(self):
        eq_(self.card.community_votes, "44")
Exemple #7
0
class WhenExtractingSingleCard(object):

    def setup(self):
        self.extractor = CardExtractor(card_html('acorn_harvest'))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_get_one_result(self):
        eq_(len(self.extracted), 1)

    def should_extract_name(self):
        assert self.card.name == 'Acorn Harvest'

    def should_extract_mana_cost(self):
        eq_(self.card.mana_cost, '3G')

    def should_extract_types(self):
        eq_(self.card.types, ['Sorcery'])

    def should_extract_text(self):
        eq_(self.card.rules_text, u'Put two 1/1 green Squirrel creature '
            u'tokens onto the battlefield. ; Flashback—{1}{G}, Pay 3 life.'
            u' (You may cast this card from your graveyard for its flashback '
            u'cost. Then exile it.)')

    def should_not_extract_rarity(self):
        assert not hasattr(self.card, 'rarity')

    def should_extract_expansion(self):
        assert not hasattr(self.card, 'expansion')

    def should_extract_artist(self):
        eq_(self.card.artist, 'Edward P. Beard, Jr.')

    def should_extract_converted_mana_cost(self):
        eq_(self.card.converted_mana_cost, '4')

    def should_extract_collector_number(self):
        eq_(self.card.collector_number, '118')

    def should_extract_expansion(self):
        eq_(self.card.printings, [('Torment', 'Common')])

    def should_extract_community_rating(self):
        eq_(self.card.community_rating, '3.330')

    def should_extract_community_votes(self):
        eq_(self.card.community_votes, '44')
Exemple #8
0
class WhenExtractingSingleCard(object):

    def setup(self):
        self.extractor = CardExtractor(card_html('acorn_harvest'))
        self.extracted = self.extractor.extract()
        self.card = self.extracted[0]

    def should_get_one_result(self):
        eq_(len(self.extracted), 1)

    def should_extract_name(self):
        assert self.card.name == 'Acorn Harvest'

    def should_extract_mana_cost(self):
        eq_(self.card.mana_cost, '3G')

    def should_extract_types(self):
        eq_(self.card.types, ['Sorcery'])

    def should_extract_text(self):
        eq_(self.card.rules_text, u'Put two 1/1 green Squirrel creature '
            u'tokens onto the battlefield. ; Flashback—{1}{G}, Pay 3 life.'
            u' (You may cast this card from your graveyard for its flashback '
            u'cost. Then exile it.)')

    def should_not_extract_rarity(self):
        assert not hasattr(self.card, 'rarity')

    def should_extract_expansion(self):
        assert not hasattr(self.card, 'expansion')

    def should_extract_artist(self):
        eq_(self.card.artist, 'Edward P. Beard, Jr.')

    def should_extract_converted_mana_cost(self):
        eq_(self.card.converted_mana_cost, '4')

    def should_extract_collector_number(self):
        eq_(self.card.collector_number, '118')

    def should_extract_expansion(self):
        eq_(self.card.printings, [('Torment', 'Common')])

    def should_extract_community_rating(self):
        eq_(self.card.community_rating, '3.330')

    def should_extract_community_votes(self):
        eq_(self.card.community_votes, '44')
Exemple #9
0
 def setup(self):
     self.extractor = CardExtractor(card_html('acorn_harvest'))
     self.extracted = self.extractor.extract()
     self.card = self.extracted[0]
Exemple #10
0
 def should_have_cards(self):
     self.extractor = CardExtractor(card_html('acorn_harvest'))
     assert self.extractor.cards
Exemple #11
0
 def setup(self):
     self.html = card_html('hex')
     self.cards = CardExtractor(self.html).extract_many()
     self.hexhunter = self.cards[1]
     self.hex_ = self.cards[2]
     self.hexmage = self.cards[8]
Exemple #12
0
 def setup(self):
     self.html = card_html('mirari')
     self.cards = CardExtractor(self.html).extract()
Exemple #13
0
 def setup(self):
     extractor = CardExtractor(card_html('garruk_relentless'))
     self.cards = extractor.extract()
Exemple #14
0
 def setup(self):
     extractor = CardExtractor(card_html('donkey'))
     self.cards = extractor.extract_many()
     self.assquatch = self.cards[0]
     self.bad_ass = self.cards[1]
     self.cheap_ass = self.cards[2]
Exemple #15
0
 def setup(self):
     extractor = CardExtractor(card_html('garruk_relentless'))
     self.cards = extractor.extract()
Exemple #16
0
 def setup(self):
     extractor = CardExtractor(card_html('sorin'))
     self.cards = extractor.extract_many()
     self.sorin_markov = self.cards[0]
Exemple #17
0
# ~ sets = [('Return to Ravnica', 'RTR'), ('Gatecrash', 'GTC'), ("Dragon's Maze", 'DGM'), ('Magic 2014 Core Set', 'M14')]
# sets = [('Theros', 'THS'),]
# sets = [('Commander 2013', 'C13'),]
sets = [
    # ('Magic 2015 Core Set', 'M15'),
    # ('Khans of Tarkir', 'KTK'),
    ("Fate Reforged", "FRF"),
]
for s in sets:
    #
    request = SearchRequest({"set": s[0]})
    cards = []
    oldcards = []
    for i in range(20):
        tmp = CardExtractor(request.url + "&page=%s" % i).cards
        if len(oldcards) > 0 and tmp[0].name == oldcards[0].name:
            break
        else:
            cards.extend(tmp)
            oldcards = tmp

    with open("%s.pot" % s[1], "wb") as dumpfile:
        dumpfile.write("#. Please leave mana costs and tap symbol intact!\n")
        for card in cards:
            dumpfile.write("#: %s\n" % smart_str(card.name))
            lines = (smart_str(card.rules_text).replace(" ; ", ";").replace(
                '"', r"\"").split(";"))
            for l in lines:
                dumpfile.write('msgid "%s"\nmsgstr ""\n\n' % l)
            dumpfile.write("\n")
Exemple #18
0
 def setup(self):
     self.extractor = CardExtractor(card_html('blazing_torch'))
     self.extracted = self.extractor.extract()
     self.card = self.extracted[0]
Exemple #19
0
 def setup(self):
     self.ex = CardExtractor(card_html('personal_incarnation'))
     self.extracted = self.ex.extract()
     self.card = self.extracted[0]
Exemple #20
0
 def setup(self):
     self.extractor = CardExtractor(card_html('acorn_harvest'))
     self.extracted = self.extractor.extract()
     self.card = self.extracted[0]
Exemple #21
0
 def setup(self):
     extractor = CardExtractor(card_html('sorin'))
     self.cards = extractor.extract_many()
     self.sorin_markov = self.cards[0]
Exemple #22
0
 def setup(self):
     self.ex = CardExtractor(card_html('personal_incarnation'))
     self.extracted = self.ex.extract()
     self.card = self.extracted[0]
Exemple #23
0
 def setUp(self):
     self.extractor = CardExtractor('html')
Exemple #24
0
 def setup(self):
     self.extractor = CardExtractor(card_html('blazing_torch'))
     self.extracted = self.extractor.extract()
     self.card = self.extracted[0]
Exemple #25
0
 def setup(self):
     extractor = CardExtractor(card_html("donkey"))
     self.cards = extractor.extract_many()
     self.assquatch = self.cards[0]
     self.bad_ass = self.cards[1]
     self.cheap_ass = self.cards[2]