def test_deck_draw_excess_reshuffle(): discardDeck = Deck(None, [Card(1, "3", "Red"), Card(2, "4", "Blue")]) cards = [Card(3, "5", "Yellow"), Card(4, "6", "Green")] deck = Deck(discardDeck, cards) drawn_cards = deck.draw(3) assert len(drawn_cards) == 3
def test_deck_draw_excess_no_discard(): cards = [Card(3, "5", "Yellow"), Card(4, "6", "Green")] deck = Deck(None, cards) drawn_cards = deck.draw(3) assert len(drawn_cards) == 2
cards.append(Card(len(cards), "reverse", color)) cards.append(Card(len(cards), "reverse", color)) cards.append(Card(len(cards), "wild", "wild")) cards.append(Card(len(cards), "wild", "wild")) cards.append(Card(len(cards), "wild", "wild")) cards.append(Card(len(cards), "wild", "wild")) cards.append(Card(len(cards), "+4", "wild")) cards.append(Card(len(cards), "+4", "wild")) cards.append(Card(len(cards), "+4", "wild")) cards.append(Card(len(cards), "+4", "wild")) # Populate main deck and create discard discard = Deck() deck = Deck(discard=discard, cards=cards) deck.shuffle() discard.cards = deck.draw(1) # Discard the top card of the deck # Create 3 players player1 = Player("Player 1", deck) player2 = Player("Player 2", deck) player3 = Player("Player 3", deck) players = [player1, player2, player3] for _ in range(7): for player in players: player.draw(1) print(json.dumps(deck.reprJSON(), cls=ComplexEncoder)) print("\n\nNew Dict:") testjson = """ {"discardDeck": {"discardDeck": null, "cards": [{"id": 101, "value": "wild", "color": "wild"}]}, "cards":