示例#1
0
    def test_draw(self):
        deck = Deck()
        self.assertRaises(DeckNotIntegerError, deck.draw, '7')
        self.assertRaises(DeckTooManyError, deck.draw, 53)

        card = deck.draw()
        self.assertIsInstance(card, Card)
        self.assertEqual(len(deck.remaining), 51)

        cards = deck.draw(4)
        for c in cards:
            self.assertIsInstance(c, Card)
            for r in deck.remaining:
                self.assertFalse(c.identical_to(r))
        self.assertEqual(len(cards), 4)
        self.assertEqual(len(deck.remaining), 47)
示例#2
0
 def test_shuffle(self):
     deck = Deck()
     deck.draw(10)
     deck.shuffle()
     self.assertEqual(len(deck.remaining), 52)