Ejemplo n.º 1
0
    def test_no_duplicates(self):
        seen_cards = set()

        hands = u.deal_hands()

        # check that each card appears only once
        for hand in hands:
            for card in hand:
                if card in seen_cards:
                    self.fail()
                seen_cards.add(card)
Ejemplo n.º 2
0
    def test_start_round_get_hand_modification(self):
        """
        The object should copy hands it emits via get_hand
        """
        hands = u.deal_hands()
        round = HeartsPreRound(hands)

        hand = round.get_hand(0)
        hand.pop()

        # this should not have changed the given hand
        self.assertNotEqual(len(hand), len(round.get_hand(0)))
Ejemplo n.º 3
0
    def test_start_round_hand_modification(self):
        """
        The object should copy hands it takes in.
        """
        hands = u.deal_hands()
        round = HeartsPreRound(hands)

        # try to modify the hand we passed in
        hands[0].pop()

        # this should not have changed the given hand
        self.assertNotEqual(len(hands[0]), len(round.get_hand(0)))
Ejemplo n.º 4
0
    def test_correct_length(self):
        hands = u.deal_hands()
        self.assertEqual(4, len(hands))

        for hand in hands:
            self.assertEqual(13, len(hand))