def find_all_valid_cards(provider: Provider, deck: Deck) -> Generator: '''find all the valid cards on this deck, filtering out cards which don't play nice with deck issue mode''' # validate_card_issue_modes must recieve a full list of cards, not batches unfiltered = (card for batch in get_card_bundles(provider, deck) for card in batch) for card in validate_card_issue_modes(deck.issue_mode, list(unfiltered)): yield card
def test_validate_none_card_issue_mode(): '''test card filtering against None deck''' deck = Deck( name="decky", number_of_decimals=0, issue_mode=IssueMode.NONE.value, network="tppc", production=True, version=1, ) cards = few_random_cards(deck, 8, 'issue') assert len(validate_card_issue_modes(deck.issue_mode, cards)) == 0
def test_validate_wild_three_way_combos(combo): deck = Deck( name="decky", number_of_decimals=0, issue_mode=combo[0] + combo[1] + combo[2], network="tppc", production=True, version=1, ) issues = few_random_cards(deck, 5, 'issue') other = few_random_cards(deck, 15, 'transfer') assert isinstance( validate_card_issue_modes(deck.issue_mode, issues + other), list)
def test_validate_10combo_card_issue_mode(): '''combo ONCE [2] and MONO [8]''' deck = Deck( name="decky", number_of_decimals=0, issue_mode=10, network="tppc", production=True, version=1, ) issues = few_random_cards(deck, 3, 'issue') other = few_random_cards(deck, 20, 'transfer') assert len(validate_card_issue_modes(deck.issue_mode, issues + other)) == 21
def test_validate_subscription_card_issue_mode(): '''test card filtering against SUBSCRIPTION deck''' deck = Deck( name="decky", number_of_decimals=0, issue_mode=IssueMode.SUBSCRIPTION.value, network="tppc", production=True, version=1, ) issues = few_random_cards(deck, 10, 'issue') other = few_random_cards(deck, 9, 'transfer', 1) assert len(validate_card_issue_modes(deck.issue_mode, issues + other)) == 10
def test_validate_unflushable_card_issue_mode(): '''test card filtering against None deck''' deck = Deck( name="decky", number_of_decimals=0, issue_mode=IssueMode.UNFLUSHABLE.value, network="tppc", production=True, version=1, ) cards_issues = few_random_cards(deck, 8, 'issue') random_cards = few_random_cards(deck, 16, 'transfer') assert len( validate_card_issue_modes(deck.issue_mode, cards_issues + random_cards)) == 8
def test_validate_13combo_card_issue_mode(): '''combo CUSTOM [1], MULTI [4] and MONO [8]''' mode = IssueMode.CUSTOM.value | IssueMode.MULTI.value | IssueMode.MONO.value # 13 deck = Deck( name="decky", number_of_decimals=0, issue_mode=mode, network="tppc", production=True, version=1, ) issues = few_random_cards(deck, 10, 'issue') other = few_random_cards(deck, 2, 'transfer', 1) assert len(validate_card_issue_modes(deck.issue_mode, issues + other)) == 12
def test_validate_28combo_card_issue_mode(): '''combo MULTI [4], MONO [8] and UNFLUSHABLE [10]''' mode = IssueMode.MULTI.value | IssueMode.MONO.value | IssueMode.UNFLUSHABLE.value # 28 deck = Deck( name="decky", number_of_decimals=0, issue_mode=mode, network="tppc", production=True, version=1, ) issues = few_random_cards(deck, 10, 'issue') other = few_random_cards(deck, 2, 'transfer', 1) assert len(validate_card_issue_modes(deck.issue_mode, issues + other)) == 10
def test_validate_singlet_card_issue_mode(): '''test card filtering against SINGLET deck''' deck = Deck( name="decky", number_of_decimals=0, issue_mode=IssueMode.SINGLET.value, network="tppc", production=True, version=1, ) first_issue = few_random_cards(deck, 10, 'issue', 1) # first 10, with amount=1 second_issue = few_random_cards(deck, 5, 'issue') # with random amounts assert len( validate_card_issue_modes(deck.issue_mode, first_issue + second_issue)) == 1