def testDraw(self): d3 = cards.Deck() d4 = cards.Deck() d4 = d4.cards[:5] h1 = cards.Hand(d4) length_before = len(h1.init_cards) deck_length_before = len(d3.cards) h1.draw(d3) length_after = len(h1.init_cards) deck_length_after = len(d3.cards) self.assertEqual(length_before, (length_after - 1)) self.assertEqual(deck_length_before, (deck_length_after +1))
def test_8_replace(self): d1 = cards.Deck() len1 = len(d1.cards) c1 = d1.cards[0] d1.replace_card(c1) len2 = len(d1.cards) self.assertEqual(len2, len1)
def test_7_replace(self): d1 = cards.Deck() c1 = d1.deal_card() len1 = len(d1.cards) d1.replace_card(c1) len2 = len(d1.cards) self.assertEqual(len2-len1, 1)
def test_3_draw(self): list_init = [] h1 = cards.Hand(list_init) len_hand_before_draw = len(h1.init_cards) d1 = cards.Deck() len_deck_before_draw = len(d1.cards) h1.draw(d1) len_hand_after_draw = len(h1.init_cards) len_deck_after_draw = len(d1.cards) self.assertEqual(len_hand_after_draw-len_hand_before_draw, 1) self.assertEqual(len_deck_before_draw-len_deck_after_draw, 1)
def testAddAndRemove(self): d2 = cards.Deck() d2.shuffle() new_card = d2.cards[6] d2 = d2.cards[:5] h1 = cards.Hand(d2) len_before = len(h1.init_cards) h1.add_card(new_card) len_after = len(h1.init_cards) h1.remove_card() len_after_removal = len(h1.init_cards) self.assertEqual(len_before, (len_after - 1)) self.assertEqual(len_after, (len_after_removal + 1))
def testInitialize(self): d1 = cards.Deck() d1.shuffle() d1 = d1.cards[:5] h1 = cards.Hand(d1) self.assertEqual(d1, h1.init_cards)
def test_6_deal(self): d1 = cards.Deck() len1 = len(d1.cards) d1.deal_card() len2 = len(d1.cards) self.assertEqual(len1-len2, 1)
def test_5_deal(self): d1 = cards.Deck() c1 = d1.deal_card() self.assertIsInstance(c1, cards.Card)
def test_4_deck(self): d1 = cards.Deck() self.assertEqual(len(d1.cards), 52)