def should_render_all_cards(self): self.assertEqual( CardList(self.cards).render(), [ separator, u'Name 2UUU', u'Legendary Creature — Human Wizard', u'Text: (3/4) Rules Text (This is just an example.)', u'Time Spiral (Rare)', separator, u'Worldspine Wurm 8GGG', u'Creature — Wurm', u'Text: (15/15) Trample ; When Worldspine Wurm dies, put three 5/5 green', u'Wurm creature tokens with trample onto the battlefield. ; When', u'Worldspine Wurm is put into a graveyard from anywhere, shuffle it into', u'its owner\'s library.', u'Return to Ravnica (Mythic Rare)', u'\n2 results found.' ])
def should_remove_empty_json_keys(self): cardlist = CardList(self.cards, json=True) cards = json.loads(''.join(cardlist.render())) self.assertTrue('loyalty' not in cards[0])
def should_render_json_lists(self): cardlist = CardList(self.cards, json=True) cards = json.loads(''.join(cardlist.render())) self.assertTrue('name' in cards[0])
def should_give_message_if_no_results(self): cardlist = CardList([]) self.assertEqual(cardlist.render(), ['No results found.'])
def should_correctly_pluralize_results(self): cardlist = CardList([Card(), Card(), Card()]) self.assertEqual(cardlist.num_results(), '\n3 results found.')
def should_correctly_singularize_results(self): cardlist = CardList([Card()]) self.assertEqual(cardlist.num_results(), '\n1 result found.')