Esempio n. 1
0
    def test_deck_deal(self):
        d = Deck()

        c = d.deal()
        self.assertFalse(d.contains(c))

        d2 = Deck()
        self.assertTrue(d2.contains(c))
Esempio n. 2
0
    def test_deck_deal(self):
        d = Deck()

        c = d.deal()
        self.assertFalse(d.contains(c))

        d2 = Deck()
        self.assertTrue(d2.contains(c))
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)