dominiontabs/domdiv/tests/carddb_tests.py
Peter c5c876f8c5 animals user expansion from BBG user rillaith (#148)
* animals user expansion from BBG user rillaith
* Added fan attribute to animals set
* animals.png - This is not the best image.  But it is the best I could get from the original files. I *think* it is 3 penguins.
* updated main.py for fan based expansions
This includes two items:
1) adds --fan for specifying fan expansions to include
2) adds wild cards in specifying both --expansion as well as --fan.  This also fixes issue #149
* Updated all language files for animals
* Normalize all line endings and add gitattributes file to make git do so in the future
* print the possible expansions when non-matching ones are provided
* Allow for no official expansions to be included
Kept the default behavior.  Not specifying '--expansions' will have the same outcome as '--expansions *' (i.e., will print all of them.)
Specifying '--expansions  ' (without any named expansions) or '--expansions none ' will result in no cards from any Official expansion.

For Fan expansions, the absence of '--fan', '--fan   ' (without any named fan expansion), and '--fan none ' will all prevent any Fan expansions from printing.
* Cleaned up expansion/fan lists
2017-03-25 21:39:49 -07:00

59 lines
1.9 KiB
Python

import unittest
from .. import main
from .. import cards as domdiv_cards
class TestCardDB(unittest.TestCase):
def test_cardread(self):
options = main.parse_opts([])
options.data_path = '.'
cards = main.read_card_data(options)
self.assertEquals(len(cards), 448)
valid_cardsets = {
u'base',
u'dominion1stEdition',
u'dominion2ndEdition',
u'dominion2ndEditionUpgrade',
u'intrigue1stEdition',
u'intrigue2ndEdition',
u'intrigue2ndEditionUpgrade',
u'seaside',
u'alchemy',
u'prosperity',
u'cornucopia extras',
u'cornucopia',
u'hinterlands',
u'dark ages',
u'dark ages extras',
u'guilds',
u'adventures',
u'adventures extras',
u'empires',
u'empires extras',
u'promo',
u'extras',
u'animals'
}
for c in cards:
self.assertIsInstance(c, domdiv_cards.Card)
self.assertIn(c.cardset_tag, valid_cardsets)
def test_languages(self):
# for now, just test that they load
options = main.parse_opts(['--language', 'it'])
options.data_path = '.'
cards = main.read_card_data(options)
self.assertTrue(cards, 'Italians cards did not read properly')
cards = main.add_card_text(options, cards, 'en_us')
cards = main.add_card_text(options, cards, 'it')
self.assertIn("Maledizione", [card.name for card in cards])
options = main.parse_opts(['--language', 'de'])
options.data_path = '.'
cards = main.read_card_data(options)
self.assertTrue(cards, 'German cards did not read properly')
cards = main.add_card_text(options, cards, 'en_us')
cards = main.add_card_text(options, cards, 'de')
self.assertIn("Fluch", [card.name for card in cards])