コード例 #1
0
ファイル: test-Hand.py プロジェクト: von/pyPoker
 def test_too_many_cards(self):
     """Test adding too many cards to a hand."""
     hand = Hand.fromString("AC 2C 3C 4C 5C")
     self.assertEquals(len(hand), 5)
     with self.assertRaises(TooManyCardsException):
         hand.append(Card.fromString("6C"))
     self.assertEquals(len(hand), 5)
コード例 #2
0
ファイル: test-Cards.py プロジェクト: thecowboy/pyPoker
 def testAceLowHighNonAce(self):
     """Test making sure makeAcesLow() and makeAcesHigh() have no effect on non-ace"""
     c = Card.fromString("9D")
     self.assertEquals(c.rank, Rank.NINE)
     c.makeAcesLow()
     self.assertEquals(c.rank, Rank.NINE)
     c.makeAcesHigh()
     self.assertEquals(c.rank, Rank.NINE)
コード例 #3
0
ファイル: test-Cards.py プロジェクト: thecowboy/pyPoker
 def testAceLowHigh(self):
     """Test making Aces high and low."""
     c = Card.fromString("AC")
     self.assertEquals(c.rank, Rank.ACE)
     c.makeAcesLow()
     self.assertEquals(c.rank, Rank.ACE_LOW)
     c.makeAcesHigh()
     self.assertEquals(c.rank, Rank.ACE)
コード例 #4
0
ファイル: test-Cards.py プロジェクト: von/pyPoker
 def testIsEightOrLower(self):
     """Test IsEightOrLower() method"""
     for rank in range(Rank.ACE_LOW, Rank.NINE):
         c = Card((rank, Suit.CLUBS))
         self.assertTrue(c.isEightOrLower(), "%s failed" % c)
     for rank in range(Rank.NINE, Rank.ACE):
         c = Card((rank, Suit.HEARTS))
         self.assertFalse(c.isEightOrLower(), "%s failed" % c)
     c = Card((Rank.ACE, Suit.DIAMONDS))
     self.assertTrue(c.isEightOrLower(), "%s failed" % c)