def test_2_testAddAndRemove(self): list_init = [] h1 = cards.Hand(list_init) len1 = len(h1.init_cards) c1 = cards.Card() if c1 in list_init: h1.add_card(c1) len2 = len(h1.init_cards) self.assertEqual(len1-len2, 0) c2 = cards.Card() if c2 in list_init: h1.remove_card(c2) len3 = len(h1.init_cards) self.assertEqual(len3-len1, 1) else: h1.remove_card(c2) len4 = len(h1.init_cards) self.assertEqual(len4-len1, 0) else: h1.add_card(c1) len2 = len(h1.init_cards) self.assertEqual(len2-len1, 1) c2 = cards.Card() if c2 in list_init: h1.remove_card(c2) len5 = len(h1.init_cards) self.assertEqual(len5-len1, 0) else: h1.remove_card(c2) len6 = len(h1.init_cards) self.assertEqual(len6-len1, 1)
def test_3_str(self): card = cards.Card(suit=3, rank=13) self.assertEqual(str(card), "King of Spades")
def test_2_clubs(self): card = cards.Card(suit=1) self.assertEqual(card.suit_name, "Clubs")
def test_1_queen(self): card = cards.Card(rank=12) self.assertEqual(card.rank_name, "Queen")
def test_0_create(self): card = cards.Card() self.assertEqual(card.suit_name, "Diamonds") self.assertEqual(card.rank, 2)