コード例 #1
0
 def roll(self):
     self.hand = dice.Hand()
     return
コード例 #2
0
 def test_chance(self):
     hand = dice.Hand()
     hand[:] = self._seed([4, 3, 3, 2, 1])
     self.assertEqual(hand.score_chance(), 13)
コード例 #3
0
 def test_max_score(self):
     hand = dice.Hand()
     hand[:] = self._seed([2, 2, 5, 5, 5])
     self.assertEqual(hand.score_max(), 'full_house')
コード例 #4
0
 def test_large_straight(self):
     hand = dice.Hand()
     hand[:] = self.dice[1:]
     self.assertEqual(hand.score_large_straight(), 20)
コード例 #5
0
 def test_full_house(self):
     hand = dice.Hand()
     hand[:] = self._seed([1, 1, 1, 5, 5])
     self.assertEqual(hand.score_full_house(), 13)
コード例 #6
0
 def test_yatzy(self):
     hand = dice.Hand()
     hand[:] = self._seed([2, 2, 2, 2, 2])
     self.assertEqual(hand.score_yatzy(), 50)
コード例 #7
0
 def test_small_straight(self):
     hand = dice.Hand()
     hand[:] = self.dice[:5]
     self.assertEqual(hand.score_small_straight(), 15)
コード例 #8
0
 def test_three_of_a_kind(self):
     hand = dice.Hand()
     hand[:] = self._seed([2, 2, 2, 4, 5])
     self.assertEqual(hand.score_three_of_a_kind(), 6)
コード例 #9
0
 def test_four_of_a_kind(self):
     hand = dice.Hand()
     hand[:] = self._seed([2, 2, 2, 2, 5])
     self.assertEqual(hand.score_four_of_a_kind(), 8)
コード例 #10
0
 def test_two_pairs_no_pairs(self):
     hand = dice.Hand()
     hand[:] = self.dice[1:]
     self.assertEqual(hand.score_two_pairs(), 0)
コード例 #11
0
 def test_two_pairs_one_pair(self):
     hand = dice.Hand()
     hand[:] = [self.dice[0], self.dice[0], self.dice[3]]
     self.assertEqual(hand.score_two_pairs(), 2)
コード例 #12
0
 def test_one_pair_no_pairs(self):
     hand = dice.Hand()
     hand[:] = self.dice[:5]
     self.assertEqual(hand.score_one_pair(), 0)
コード例 #13
0
 def test_sixes(self):
     hand = dice.Hand()
     hand[:] = self.dice[1:]
     self.assertEqual(hand.score_sixes(), 6)
コード例 #14
0
 def test_fives(self):
     hand = dice.Hand()
     hand[:] = self.dice[:5]
     self.assertEqual(hand.score_fives(), 5)
コード例 #15
0
 def test_twos(self):
     hand = dice.Hand()
     hand[:] = self.dice[:5]
     self.assertEqual(hand.score_twos(), 2)
コード例 #16
0
 def test_hand(self):
     hand = dice.Hand()
     self.assertEqual(len(hand), 5)