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)
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)
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)