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)
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)
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)
def test_score(self): self.assertEqual(cribbage.score_hand(self.deck), self.dscore) self.assertEqual(cribbage.score_hand(self.spades), self.sscore)
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)
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)