예제 #1
0
 def test_hand_ace3(self):
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "Ten"))
     playersHand.add_card(Card("Spades", "Ten"))
     playersHand.add_card(Card("Clubs", "Ace"))
     self.assertEqual(31, playersHand.value)
     playersHand.adjust_for_ace()
     self.assertEqual(21, playersHand.value)
예제 #2
0
 def test_hand_isDealer1(self):
     out = io.StringIO()
     sys.stdout = out
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "Ten"))
     playersHand.add_card(Card("Spades", "Ten"))
     dealersHand = Hand()
     dealersHand.add_card(Card("Spades", "Eight"))
     dealersHand.add_card(Card("Diamonds", "Two"))
     show_some(playersHand,dealersHand)
     output = out.getvalue().strip()
     self.assertIn("<card hidden>", output)
     self.assertNotIn("Eight of Spades", output)
예제 #3
0
 def test_hand_value3(self):
     playersHand = Hand()
     playersHand.add_card(Card("Spades", "Two"))
     playersHand.add_card(Card("Hearts", "Two"))
     playersHand.add_card(Card("Diamonds", "Two"))
     playersHand.add_card(Card("Clubs", "Two"))
     self.assertEqual(8, playersHand.value)
예제 #4
0
 def test_hand_isPlayer1(self):
     out = io.StringIO()
     sys.stdout = out
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "King"))
     playersHand.add_card(Card("Hearts", "Ace"))
     dealersHand = Hand()
     dealersHand.add_card(Card("Spades", "Eight"))
     dealersHand.add_card(Card("Diamonds", "Two"))
     show_some(playersHand,dealersHand)
     output = out.getvalue().strip()
     self.assertIn("King of Clubs", output)
     self.assertIn("Ace of Hearts", output)
예제 #5
0
 def test_hand_value2(self):
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "King"))
     playersHand.add_card(Card("Hearts", "Jack"))
     self.assertEqual(4, playersHand.value)
예제 #6
0
 def test_hand_value1(self):
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "King"))
     playersHand.add_card(Card("Hearts", "Three"))
     self.assertEqual(6, playersHand.value)
예제 #7
0
 def test_hand_ace1(self):
     playersHand = Hand()
     playersHand.add_card(Card("Clubs", "King"))
     playersHand.add_card(Card("Spades", "King"))
     playersHand.add_card(Card("Clubs", "Ace"))
     self.assertEqual(17, playersHand.value)
예제 #8
0
 def test_hand_value4(self):
     playersHand = Hand()
     playersHand.add_card(Card("Spades", "Nine"))
     playersHand.add_card(Card("Hearts", "Nine"))
     playersHand.add_card(Card("Diamonds", "Nine"))
     self.assertEqual(27, playersHand.value)