def should_render_flavor_text(self): self.assertEqual( CardRenderer(self.card, flavor=True).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)', u'* * *', u'"Flavor text"', u'Time Spiral (Rare)' ])
def should_render_cards(self): self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)', u'Time Spiral (Rare)' ])
def should_print_color_indicator_if_present(self): self.card.color_indicator = 'Green' self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)', u'Color: Green', u'Time Spiral (Rare)' ])
def should_wrap_multiline_rules_text_on_linebreaks(self): self.card.rules_text = u'First Strike\nSacrifice Vampire Hexmage: Remove all counters from target permanent.' self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) First Strike', u'Sacrifice Vampire Hexmage: Remove all counters from target permanent.', u'Time Spiral (Rare)' ])
def should_wrap_long_rules_text(self): self.card.rules_text = u'If Floral Spuzzem attacks an opponent and is not blocked, then Floral Spuzzem may choose to destroy a target artifact under that opponent\'s control and deal no damage.' self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) If Floral Spuzzem attacks an opponent and is not blocked,', u'then Floral Spuzzem may choose to destroy a target artifact under that', "opponent's control and deal no damage.", u'Time Spiral (Rare)' ])
def should_not_print_numbers_on_instants(self): self.card.types = [u'Instant'] self.card.subtypes = [] self.card.power = u'' self.card.toughness = u'' self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Instant', u'Text: Rules Text (This is just an example.)', u'Time Spiral (Rare)' ])
def should_print_loyalty_on_planeswalkers(self): self.card.types = [u'Planeswalker'] self.card.subtypes = [u'Gideon'] self.card.power = u'' self.card.toughness = u'' self.card.loyalty = 5 self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Planeswalker — Gideon', u'Text: Rules Text (This is just an example.)', u'Loyalty: 5', u'Time Spiral (Rare)' ])
def should_strip_semicolons(self): self.card.rules_text = ( u"({T}: Add {W} or {B} to your mana pool.) ; As Godless Shrine enters the battlefield, you may pay 2 life. If you don't, Godless Shrine enters the battlefield tapped." ) self.card.power = u'' self.card.toughness = u'' self.assertEqual( CardRenderer(self.card, reminders=False).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: As Godless Shrine enters the battlefield, you may pay 2 life. If', u"you don't, Godless Shrine enters the battlefield tapped.", u'Time Spiral (Rare)' ])
def should_wrap_printings(self): self.card.printings = [(u'Limited Edition Alpha', u'Common'), (u'Limited Edition Beta', u'Common'), (u'Unlimited Edition', u'Common'), (u'Revised Edition', u'Common'), (u'Fourth Edition', u'Common')] self.assertEqual( CardRenderer(self.card).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)', u'Limited Edition Alpha (Common), Limited Edition Beta (Common),', u'Unlimited Edition (Common), Revised Edition (Common), Fourth Edition', u'(Common)' ])
def should_wrap_rulings(self): self.card.ruling_data = [ (u'12/1/2004', u'If you Fork a Spliced spell, the spliced text is added during the announcement of the original spell, and therefore is fully copied by Fork.' ), (u'5/1/2009', u'The copy will have the same mana cost as the original spell, but will be red rather than whatever color that mana cost would have made it.' ) ] self.assertEqual( CardRenderer(self.card, rulings=True).render_rulings(), [ u'12/1/2004: If you Fork a Spliced spell, the spliced text is added', u'during the announcement of the original spell, and therefore is fully', u'copied by Fork.', u'5/1/2009: The copy will have the same mana cost as the original spell,', u'but will be red rather than whatever color that mana cost would have', u'made it.' ])
def should_remove_reminders(self): self.assertEqual( CardRenderer(self.card, reminders=False).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text', u'Time Spiral (Rare)' ])
def should_format_rulings(self): self.assertEqual( CardRenderer(self.card, rulings=True).render_rulings(), [u'9/25/2006: Ruling Text', u'9/25/2006: Ruling Two'])
def should_render_rulings(self): output = CardRenderer(self.card, rulings=True).render() for line in CardRenderer(self.card, rulings=True).render_rulings(): self.assertTrue(line in output)
def should_hide_printings(self): self.assertEqual( CardRenderer(self.card, printings=False).render(), [ u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)' ])