Exemple #1
0
    def test_random_ordering(self):
        """Test that the actual ordering of the initial hand is randomized.

        Note that this is technically a flaky test, since we could draw
        repeated random hands and have them all be identical. But odds are
        overwhelmingly in our favor.
        """
        # The odds of getting 10 identical hands with shuffling is....low
        num_tries = 10
        attempt = 0

        while attempt < num_tries:
            attempt += 1
            deck_alt = Deck()
            if not cards_are_same(self.deck.hand, deck_alt.hand):
                raise AssertionError('Cards were non-identical!')
Exemple #2
0
    def test_starting_cards(self):
        """Test that the starting hand+draw contains the correct cards."""
        all_cards = self.deck.hand
        all_cards.extend(self.deck.draw_pile)

        assert_equal(cards_are_same(all_cards, cards.STARTING_DECK), True)