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 testDraw(self): hand = hands.Hand([]) hand_len = len(hand.init_cards) deck = cards.Deck() deck_len = len(deck.cards) hand.draw(deck) draw_deck_len = len(deck.cards) draw_hand_len = len(hand.init_cards) self.assertEqual(deck_len - draw_deck_len, 1) self.assertEqual(hand_len + 1, draw_hand_len)
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 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 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 testAddAndRemove(self): hand = hands.Hand([]) hand_len = len(hand.init_cards) card = cards.Card() hand.add_card(card) add_len = len(hand.init_cards) self.assertEqual(add_len - hand_len, 1) remcard = hand.remove_card(card) rem_len = len(hand.init_cards) if remcard is None: self.assertEqual(rem_len, add_len) else: self.assertEqual(rem_len + 1, add_len)
def testInitialize(self): d1 = cards.Deck() d1.shuffle() d1 = d1.cards[:5] h1 = cards.Hand(d1) self.assertEqual(d1, h1.init_cards)
def test_1_hand(self): list_init = [] hand = cards.Hand(list_init) self.assertIsInstance(hand, cards.Hand)