Example #1
0
 def test_score_heels(self):
     hand = self.deck.by_rank(standard.FIVE)
     turned = self.deck.by_rank(standard.JACK).pop()
     score = cribbage.score_hand(hand, turned=turned, dealer=False)
     self.assertEqual(score["heels"], 0)
     score = cribbage.score_hand(hand, turned=turned, dealer=True)
     self.assertEqual(score["heels"], 2)
Example #2
0
 def test_score_heels(self):
     hand = self.deck.by_rank(standard.FIVE)
     turned = self.deck.by_rank(standard.JACK).pop()
     score = cribbage.score_hand(hand, turned=turned, dealer=False)
     self.assertEqual(score["heels"], 0)
     score = cribbage.score_hand(hand, turned=turned, dealer=True)
     self.assertEqual(score["heels"], 2)
Example #3
0
 def test_score_crib_turn(self):
     hand = self.spades.deal(4)
     turned = self.deck.by_suit(standard.HEART).pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 0)
     turned = self.spades.pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 5)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 5)
Example #4
0
 def test_score_crib_turn(self):
     hand = self.spades.deal(4)
     turned = self.deck.by_suit(standard.HEART).pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 0)
     turned = self.spades.pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 5)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 5)
Example #5
0
 def test_score_crib_noturn(self):
     hand = self.spades.deal(4)
     score = cribbage.score_hand(hand, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, crib=True)
     self.assertEqual(score["flush"], 4)
Example #6
0
 def test_score(self):
     self.assertEqual(cribbage.score_hand(self.deck), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades), self.sscore)
Example #7
0
 def test_score_nobs(self):
     hand = self.deck.by_rank(standard.JACK)
     turned = self.deck.by_rank(standard.FIVE).pop()
     for d in [True, False]:
         score = cribbage.score_hand(hand, turned=turned, dealer=d)
         self.assertEqual(score["nobs"], 1)
Example #8
0
 def test_score_dealer_noturn(self):
     self.assertEqual(cribbage.score_hand(self.deck, dealer=True),
                      self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades, dealer=True),
                      self.sscore)
Example #9
0
 def test_score_crib_noturn(self):
     hand = self.spades.deal(4)
     score = cribbage.score_hand(hand, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, crib=True)
     self.assertEqual(score["flush"], 4)
Example #10
0
 def test_score(self):
     self.assertEqual(cribbage.score_hand(self.deck), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades), self.sscore)
Example #11
0
 def test_score_nobs(self):
     hand = self.deck.by_rank(standard.JACK)
     turned = self.deck.by_rank(standard.FIVE).pop()
     for d in [True, False]:
         score = cribbage.score_hand(hand, turned=turned, dealer=d)
         self.assertEqual(score["nobs"], 1)
Example #12
0
 def test_score_dealer_noturn(self):
     self.assertEqual(cribbage.score_hand(self.deck, dealer=True), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades, dealer=True), self.sscore)