def test_desk_shuffles_cards(self, mock_shuffle): deck = Deck() cards = [ Card(rank='7', suit='Diamonds'), Card(rank='3', suit='Spades') ] deck.add_cards(cards) deck.shuffle() assert mock_shuffle.called_once_with(cards)
def test_deck_removes_cards_from_its_collection(self): card1 = Card(rank='Ace', suit='Spades') card2 = Card(rank='4', suit='Diamonds') cards = [card1, card2] deck = Deck() deck.add_cards(cards) assert deck.remove_cards(1) == [card1] assert deck.cards == [card2]
from app.card import Card from app.deck import Deck from app.hand import Hand from app.player import Player from app.game import Game # creates a deck of 52 cards deck = Deck() cards = Card.create_deck_with_52_cards() deck.add_cards(cards) # mock game with two players hand1 = Hand(cards=[]) hand2 = Hand(cards=[]) player1 = Player(name='M', hand=hand1) player2 = Player(name='Z', hand=hand2) players = [player1, player2] # game.play() shuffles deck and deals two cards to x num of players game = Game(deck=deck, players=players) game.play() # # # creates initial three card draw # # table_hand = [] # # table_count = 0 # # for card in deck.cards: # # if table_count < 3: # # table_hand.append(card) # # deck.remove_cards(card) # # table_count += 1
def test_deck_adds_cards_to_its_collection(self): card = Card(rank='Jack', suit='Diamonds') deck = Deck() deck.add_cards([card]) assert deck.cards == [card]