Пример #1
0
    def test_init(self):
        deck = Deck()
        too_many_cards = deck.deal(10)
        with self.assertRaises(AssertionError):
            CribbageHand(too_many_cards)

        deck = Deck()
        five_cards = deck.deal(5)
        hand = CribbageHand(five_cards)

        self.assertEqual(len(hand.fullhand), 5)
        self.assertEqual(len(hand.hand), 4)
        self.assertTrue(isinstance(hand.starter, Card))
Пример #2
0
    def test_dealing_five_cards(self):
        deck = Deck()
        self.assertEqual(len(deck.cards), 52)

        hand1 = deck.deal(5)
        self.assertEqual(len(hand1), 5)
        self.assertEqual(len(deck.cards), 52 - 5)

        hand2 = deck.deal(5)
        self.assertEqual(len(hand2), 5)
        self.assertEqual(len(deck.cards), 52 - 5 - 5)

        self.assertFalse(set(deck.cards) & set(hand1) & set(hand2))