Beispiel #1
0
def test_dealSpecificCardException():
	"""
	Ensure that we're raising an exception when we can't deal a specific card.
	"""
	
	s = Shoe(6)
	s.shuffle()
	
	for x in range(0,6):
		s.dealSpecificCard("9","Spade")
	
	# This should be an exception
	with pytest.raises(Exception):
		s.dealSpecificCard("9","Spade")
Beispiel #2
0
def test_dealSpecificCard():
	"""
	Testing that dealing a specific card really only deals that specific card
	"""
	
	# Up to eight decks
	for numDecks in range(1,9):
		# For each card name
		for name in Card.enumName.keys():
			# For each card suit
			for suit in Card.enumSuit:
				# Create the shoe
				s = Shoe(numDecks)
				s.shuffle()
				# Remove this card from the shoe
				s.dealSpecificCard(name,suit)
				# count the number of times this specific card is found in the shoe
				c = len([myCard for myCard in s.getCards() if myCard.getName() == name and myCard.getSuit() == suit])
				# it should be equal to the number of decks in the shoe minus the one we just dealt
				assert c == numDecks - 1