コード例 #1
0
ファイル: test-PokerRank.py プロジェクト: von/pyPoker
 def testMax(self):
     """Test using max() with PokerRank"""
     ranks = [
         PokerRank.pair(Rank.QUEEN, kickers = Cards.fromString("JC 8D 4S")),
         PokerRank.straight(Rank.TEN),
         PokerRank.trips(Rank.SEVEN, kickers = Cards.fromString("AD JC")),
         ]
     max_rank = max(ranks)
     self.assertEqual(max_rank.getType(), PokerRank.STRAIGHT)
コード例 #2
0
ファイル: test-PokerRank.py プロジェクト: von/pyPoker
 def testKickerSort(self):
     """Test sorting of kickers."""
     kickers = Cards.fromString("8C KS AH")
     rank = PokerRank.pair(Rank.QUEEN, kickers)
     kickerRanks = rank.getKickerRanks()
     self.assertEqual(kickerRanks[0], Rank.ACE,
                      "kickerRanks[0] == %s != A" % kickerRanks[0])
     self.assertEqual(kickerRanks[1], Rank.KING,
                      "kickerRanks[1] == %s != K" % kickerRanks[1])
     self.assertEqual(kickerRanks[2], Rank.EIGHT,
                      "kickerRanks[2] == %s != 8" % kickerRanks[2])
     # Now test with Ace low
     kickers.makeAcesLow()
     rank = PokerRank.pair(Rank.QUEEN, kickers)
     kickerRanks = rank.getKickerRanks()
     self.assertEqual(kickerRanks[0], Rank.KING,
                      "kickerRanks[0] == %s != K" % kickerRanks[0])
     self.assertEqual(kickerRanks[1], Rank.EIGHT,
                      "kickerRanks[1] == %s != 8" % kickerRanks[1])
     self.assertEqual(kickerRanks[2], Rank.ACE_LOW,
                      "kickerRanks[2] == %s != A" % kickerRanks[2])