def test_exclude_expansion(): # test that we can use --exclude-expansion or # --exclude-expansions, that we can have multiple # items with a single flag, that * syntax # works, that we can use either the # cardset tag or name, and that capitalization # doesn't matter options = main.parse_opts([ "--expansions", "adventures", "dominion*", "intrigue*", "--exclude-expansions", "dominiOn1stEditIon", "intrigue 2nd*", "--exclude-expansion", "dominion 2nd edition", ]) options = main.clean_opts(options) options.data_path = "." cards = main.read_card_data(options) cards = main.filter_sort_cards(cards, options) card_sets = set(x.cardset.lower() for x in cards) assert card_sets == { "adventures", "dominion 2nd edition upgrade", "intrigue 1st edition", }
def test_expansion_description_card_order(): # test that the expansions cards lists cards # in alphabetical order, like they are printed, # and that accents don't matter options = main.parse_opts([ "--expansions", "Hinterlands", "--expansion-dividers", "--language", "fr", "--only-type-any", "Expansion", ]) options = main.clean_opts(options) options.data_path = "." cards = main.read_card_data(options) cards = main.filter_sort_cards(cards, options) card_names = [c.strip() for c in cards[0].description.split("|")] # The 26 french card names of the Hinterlands expansion should be sorted as if no accent assert len(card_names) == 26 assert card_names == sorted( card_names, key=lambda s: "".join(c for c in unicodedata.normalize("NFD", s) if unicodedata.category(c) != "Mn"), )
def test_only_type(): options = main.parse_opts( [ "--expansions", "base", "alchemy", "--include-blanks", "5", "--only-type-any", "blank", "curse", "--only-type-all", "attack", "action", ] ) options = main.clean_opts(options) options.data_path = "." cards = main.read_card_data(options) cards = main.filter_sort_cards(cards, options) # Total 8 from # Blank: +5 added in options # Curse: +1 from base # Action Attack: +2 from Alchemy assert len(cards) == 8