Exemplo n.º 1
0
 def testB_equalToOtherTripsWhenAllCardsAreEqual(self):
     '''equal to other trips when other cards in the hand are equal'''
     tripsA = cards('3D,3S,3D,5D,6H,8H,9H,10H')
     tripsB = cards('3D,3S,3D,5D,6H,8H,9H,10H')
     self.assertEqual(Hand(tripsA), Hand(tripsB))
Exemplo n.º 2
0
 def testC_highCardWinsWhenPairsAreEqual(self):
     '''the high card wins when the pairs are equal'''
     twoPairA = cards('5D,5S,4C,4D,6H,8H,9H,11H')
     twoPairB = cards('5D,5S,4C,4D,6H,8H,9H,10H')
     self.assertGreater(Hand(twoPairA), Hand(twoPairB))
Exemplo n.º 3
0
 def testA_beatsTripsWithOfLowerCard(self):
     '''beats trips with of lower card'''
     tripsA = cards('3D,3S,3D,5D,6H,8H,9H,10H')
     tripsB = cards('2D,2S,2C,5D,6H,8H,9H,10H')
     self.assertGreater(Hand(tripsA), Hand(tripsB))
Exemplo n.º 4
0
 def testC_beatsHighCardHand(self):
     '''beats a high card hand'''
     aPair = cards('5D,5S,3C,4D,6H,8H,9H,11H')
     aHighCard = cards('2D,4S,5C,6D,7H,9H,10H,12H')
     self.assertGreater(Hand(aPair), Hand(aHighCard))
Exemplo n.º 5
0
 def testA_beatsTwoPairOnHighPair(self):
     '''beats two pair with lower high pair'''
     twoPairA = cards('5D,5S,4C,4D,6H,8H,9H,10H')
     twoPairB = cards('4D,4S,2C,2D,6H,8H,9H,10H')
     self.assertGreater(Hand(twoPairA), Hand(twoPairB))
Exemplo n.º 6
0
 def testA_beatsPoker(self):
     '''beats a poker'''
     aStraightFlush = cards('3C,4C,5C,6C,7C,8H,9H,10H')
     aPoker = cards('2D,2C,2H,2S,6D,8H,9H,10H')
     self.assertGreater(Hand(aStraightFlush), Hand(aPoker))
Exemplo n.º 7
0
 def testA_beatsLowerPair(self):
     '''beats a lower pair'''
     pairA = cards('5D,5S,3C,4D,6H,8H,9H,10H')
     pairB = cards('4D,4S,3C,2D,6H,8H,9H,10H')
     self.assertGreater(Hand(pairA), Hand(pairB))
Exemplo n.º 8
0
 def testB_beatsStraight(self):
     '''beats a striaght'''
     aFlush = cards('3D,5D,8D,6D,10D,8H,9H,10H')
     aStraight = cards('2D,3S,4S,5D,6H,8H,9H,10H')
     self.assertGreater(Hand(aFlush), Hand(aStraight))
Exemplo n.º 9
0
 def testA_beatsFullHouseWithLowerValue(self):
     '''beats a poker with a lower value'''
     fullHouseA = cards('3D,3C,3H,6S,6D,8H,9H,10H')
     fullHouseB = cards('2D,2C,2H,6S,6D,8H,9H,10H')
     self.assertGreater(Hand(fullHouseA), Hand(fullHouseB))
Exemplo n.º 10
0
 def testA_sameAsFlushWithMatchingValues(self):
     '''is ranked the same as a flush with matching values'''
     flushA = cards('2D,4D,6D,8D,10D,8H,9H,10H')
     flushB = cards('2C,4C,6C,8C,10C,8H,9H,10H')
     self.assertEqual(Hand(flushA), Hand(flushB))
Exemplo n.º 11
0
 def testB_beatsFlushWithLowerHighCard(self):
     '''beats a flush with a lower high card'''
     flushA = cards('2D,4D,6D,8D,10D,8H,9H,10H')
     flushB = cards('2C,4C,6C,8C,9C,8H,9H,10H')
     self.assertGreater(Hand(flushA), Hand(flushB))
Exemplo n.º 12
0
 def testB_beatsTrips(self):
     '''beats trips'''
     aStraight = cards('2D,3S,4S,5D,6H,8H,9H,10H')
     aTrips = cards('2D,2S,2C,5D,6H,8H,9H,10H')
     self.assertGreater(Hand(aStraight), Hand(aTrips))
Exemplo n.º 13
0
 def testB_beatsStraightWithLowerHighCard(self):
     '''beats a straight with a lower high card'''
     straightA = cards('3D,4H,5S,6S,7H,8H,9H,10H')
     straightB = cards('2D,3S,4S,5D,6H,8H,9H,10H')
     self.assertGreater(Hand(straightA), Hand(straightB))
Exemplo n.º 14
0
 def testA_sameAsStraightWithMatchingValues(self):
     '''is ranked the same as a straight with matching values'''
     straightA = cards('2C,3D,4H,5S,6S,8H,9H,10H')
     straightB = cards('2D,3S,4S,5D,6H,8H,9H,10H')
     self.assertEqual(Hand(straightA), Hand(straightB))
Exemplo n.º 15
0
 def testA_twoStraightFlushesAreEqual(self):
     '''two straight flushes are equal when they have the same value'''
     straightFlushA = cards('2C,3C,4C,5C,6C,8H,9H,10H')
     straightFlushB = cards('2D,3D,4D,5D,6D,8H,9H,10H')
     self.assertEqual(Hand(straightFlushA), Hand(straightFlushB))
Exemplo n.º 16
0
 def testB_beatsFlush(self):
     '''beats a flush'''
     aFullHouse = cards('2D,2C,4H,4S,4D,8H,9H,10H')
     aFlush = cards('3D,5D,8D,6D,10D,8H,9H,10H')
     self.assertGreater(Hand(aFullHouse), Hand(aFlush))
Exemplo n.º 17
0
 def testB_beatsStraightFlushWithLowerValue(self):
     '''beats a straight flush with a lower value'''
     straightFlushA = cards('3C,4C,5C,6C,7C,8H,9H,10H')
     straightFlushB = cards('2D,3D,4D,5D,6D,8H,9H,10H')
     self.assertGreater(Hand(straightFlushA), Hand(straightFlushB))
Exemplo n.º 18
0
 def testC_cannotBeatPoker(self):
     '''cannot beat a poker'''
     aFullHouse = cards('2D,2C,4H,4S,4D,8H,9H,10H')
     aPoker = cards('3D,3C,3H,3S,6D,8H,9H,10H')
     self.assertLess(Hand(aFullHouse), Hand(aPoker))
Exemplo n.º 19
0
 def testA_beatsLowerHighCard(self):
     '''beats a lower high card'''
     highCardA = cards('2D,4S,5C,6D,7H,9H,10H,13H')
     highCardB = cards('2D,4S,5C,6D,7H,9H,10H,12H')
     self.assertGreater(Hand(highCardA), Hand(highCardB))
Exemplo n.º 20
0
 def testA_theyAreEqual(self):
     '''they are equal'''
     self.assertEqual(Hand([]), Hand([]))
Exemplo n.º 21
0
 def testB_beatsMatchingPairOnHighCard(self):
     '''beats a matching pair on the high card'''
     pairA = cards('5D,5S,3C,4D,6H,8H,9H,11H')
     pairB = cards('5D,5S,3C,4D,6H,8H,9H,10H')
     self.assertGreater(Hand(pairA), Hand(pairB))
Exemplo n.º 22
0
 def testA_beatsPokerWithLowerValue(self):
     '''beats a poker with a lower value'''
     pokerA = cards('3D,3C,3H,3S,6D,8H,9H,10H')
     pokerB = cards('2D,2C,2H,2S,6D,8H,9H,10H')
     self.assertGreater(Hand(pokerA), Hand(pokerB))
Exemplo n.º 23
0
 def testD_equalWhenAllCardsAreSame(self):
     '''beats a matching pair on the high card'''
     pairA = cards('5D,5S,3C,4D,6H,8H,9H,11H')
     pairB = cards('5C,5H,3C,4D,6C,8H,9H,11H')
     self.assertEqual(Hand(pairA), Hand(pairB))
Exemplo n.º 24
0
 def testB_onlyEqualWhenAllValuesMatch(self):
     '''equal when all values including high card match'''
     pokerA = cards('3D,3C,3H,3S,6D,8H,9H,10H')
     pokerB = cards('3D,3C,3H,3S,6D,7H,6H,10H')
     self.assertEqual(Hand(pokerA), Hand(pokerB))
Exemplo n.º 25
0
 def testB_beatsTwoPairOnLowPair(self):
     '''when high pairs are even, beats two pair with higheswt low pair'''
     twoPairA = cards('5D,5S,4C,4D,6H,8H,9H,10H')
     twoPairB = cards('5D,5S,2C,2D,6H,8H,9H,10H')
     self.assertGreater(Hand(twoPairA), Hand(twoPairB))
Exemplo n.º 26
0
 def testC_beatsFullHouse(self):
     '''beats a full house'''
     aPoker = cards('3D,3C,3H,3S,6D,8H,9H,10H')
     aFullHouse = cards('2D,2C,4H,4S,4D,8H,9H,10H')
     self.assertGreater(Hand(aPoker), Hand(aFullHouse))
Exemplo n.º 27
0
 def testD_equalWhenTwoPairAndHighCArdAreEqual(self):
     '''equal when the two pairs and the high card are equal'''
     twoPairA = cards('5D,5S,4C,4D,6H,8H,9H,10H')
     twoPairB = cards('5D,5S,4C,4D,6H,8H,9H,10H')
     self.assertEqual(Hand(twoPairA), Hand(twoPairB))
Exemplo n.º 28
0
 def testE_beatsPokerOfSameValueWithHighCard(self):
     '''beats a poker with the same value on high card'''
     pokerA = cards('3D,3C,3H,3S,6D,8H,9H,11H')
     pokerB = cards('3D,3C,3H,3S,6D,8H,9H,10H')
     self.assertGreater(Hand(pokerA), Hand(pokerB))
Exemplo n.º 29
0
 def hand(self):
     return Hand(self._cards)
Exemplo n.º 30
0
 def testC_beatsTwoPair(self):
     '''beats two pair'''
     aTrips = cards('3D,3S,3D,5D,6H,8H,9H,10H')
     aTwoPair = cards('2D,2S,4C,4D,6H,8H,9H,10H')
     self.assertGreater(Hand(aTrips), Hand(aTwoPair))