Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
u"nocturne extras",
u"promo",
u"renaissance",
u"menagerie",
u"extras",
u"animals",
}
for c in cards:
assert isinstance(c, domdiv_cards.Card)
assert c.cardset_tag in valid_cardsets
# Option modified card count
options = main.parse_opts(
["--no-trash", "--curse10", "--start-decks", "--include-blanks", "7"]
)
options = main.clean_opts(options)
options.data_path = "."
cards = main.read_card_data(options)
# Total delta cards is +28 from
# Trash: -1 * 3 sets = -3
# Curse: +2 * 4 sets = +8
# Start Decks: +4 * 4 sets = +16
# Blanks: +7 = +7
assert len(cards) == num_cards_expected + 28
def test_set_icon():
options = main.parse_opts([])
options = main.clean_opts(options)
assert options.set_icon == ["tab"]
options = main.parse_opts(["--set-icon=tab"])
options = main.clean_opts(options)
assert options.set_icon == ["tab"]
options = main.parse_opts(["--set-icon=body-top"])
options = main.clean_opts(options)
assert options.set_icon == ["body-top"]
options = main.parse_opts(["--set-icon=hide"])
options = main.clean_opts(options)
assert options.set_icon == ["hide"]
options = main.parse_opts(["--set-icon=tab", "--set-icon=body-top"])
options = main.clean_opts(options)
# 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():
# test that we can use --expansion or
# --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(
[
"--expansion",
"advEntUres",
"dominion 2nd*",
"--expansions=intrigue1stEdition",
]
)
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",
"dominion 2nd edition upgrade",
"intrigue 1st edition",
}
def test_cost():
options = main.parse_opts([])
options = main.clean_opts(options)
assert options.cost == ["tab"]
options = main.parse_opts(["--cost=tab"])
options = main.clean_opts(options)
assert options.cost == ["tab"]
options = main.parse_opts(["--cost=body-top"])
options = main.clean_opts(options)
assert options.cost == ["body-top"]
options = main.parse_opts(["--cost=hide"])
options = main.clean_opts(options)
assert options.cost == ["hide"]
options = main.parse_opts(["--cost=tab", "--cost=body-top"])
options = main.clean_opts(options)
assert set(options.cost) == {"tab", "body-top"}