def test_deck_deal(self): d = Deck() c = d.deal() self.assertFalse(d.contains(c)) d2 = Deck() self.assertTrue(d2.contains(c))
def test_joker_deck(self): d = Deck(jokers=4) cards = [d.deal() for r in range(20)] card_count = defaultdict(int) for c in cards: card_count[c.suit] += 1 self.assertEqual(len(d.cards), 36) print(card_count) print(unicode(d)) self.assertEqual(card_count['Wild'], 2)
def test_joker_deck(self): d = Deck(jokers=4) cards = [ d.deal() for r in range(20) ] card_count = defaultdict(int) for c in cards: card_count[c.suit] += 1 self.assertEqual(len(d.cards), 36) print(card_count) print(unicode(d)) self.assertEqual(card_count['Wild'], 2)
def test_shuffle(self): d = Deck() cards = [d.deal() for r in range(20)] print(unicode(d)) self.assertEqual(len(d.cards), 32) card_count = defaultdict(int) for c in cards: card_count[c.suit] += 1 print(card_count) self.assertGreater(card_count['Spades'], 4) self.assertGreater(card_count['Hearts'], 3) self.assertGreater(card_count['Clubs'], 7) self.assertGreater(card_count['Diamonds'], 2)
def test_shuffle(self): d = Deck() cards = [ d.deal() for r in range(20) ] print(unicode(d)) self.assertEqual(len(d.cards), 32) card_count = defaultdict(int) for c in cards: card_count[c.suit] += 1 print(card_count) self.assertGreater(card_count['Spades'], 4) self.assertGreater(card_count['Hearts'], 3) self.assertGreater(card_count['Clubs'], 7) self.assertGreater(card_count['Diamonds'], 2)