Exemplo n.º 1
0
    def test_card(self):
        x = Card('Ah')

        #case 1: make sure that when we set a card, the value is consistent
        self.assertTrue(x.short_name() == 'Ah')
        self.assertTrue(x.single_name() == 'Y')

        #case 2: make sure that when we set a card, the suit and value match
        y = Card('Ad')
        self.assertTrue(x.value == y.value)

        #case 3: make sure that Ah and Ad have different suits
        self.assertFalse(x.suit == y.suit)
        
        #case 4: test setting the card by long name
        y.set_value_by_name('Deuce')
        y.set_suit_by_name('Hearts')
        self.assertTrue(y.short_name() == '2h')