def CardIsPlayable(self, card): c = Card(card) if self.piles[c.GetSuit()] + 1 == c.GetValue(): return True else: return False
def testValidCardNumber(self): testCard0 = Card(3, "Spades") self.assertEqual(testCard0.GetSuit(), "Spades", "Failed constructing correct suit 3 of spades") self.assertEqual(testCard0.GetValue(), 3, "Failed constructing correct suit 3 of spades")
def testValidAce(self): testCard4 = Card(14, "Clubs") #Ace or 14 self.assertEqual(testCard4.GetSuit(), "Clubs", "Failed constructing correct suit Ace of Clubs") self.assertEqual(testCard4.GetValue(), 14, "Failed constructing correct suit Ace of Clubs")
def testValidKingFace(self): testCard3 = Card(13, "Diamonds") #King self.assertEqual(testCard3.GetSuit(), "Diamonds", "Failed constructing correct suit King of Diamonds") self.assertEqual(testCard3.GetValue(), 13, "Failed constructing correct suit King of Diamonds")
def testValidQueenFace(self): testCard2 = Card(12, "Hearts") #Queen self.assertEqual(testCard2.GetSuit(), "Hearts", "Failed constructing correct suit Queen of Hearts") self.assertEqual(testCard2.GetValue(), 12, "Failed constructing correct suit Queen of Hearts")
def testValidJackFace(self): testCard1 = Card(11, "Spades") #Jack self.assertEqual(testCard1.GetSuit(), "Spades", "Failed constructing correct suit Jack of spades") self.assertEqual(testCard1.GetValue(), 11, "Failed constructing correct suit Jack of spades")