def testTableauToFoundationSuitGoodRankGood(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Good suit, good rank.
        """
        # test source tableau
        test_src_card = cards.Card(rank=2, suit=1)
        test_tab_col_src = [test_src_card]
        # test destination foundation with an ace on top
        test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
        proj10.tableau_to_foundation(test_tab_col_src, test_fnd_col_dest)
        self.assertTrue(
            test_fnd_col_dest[-1] == test_src_card,
            msg="tab_to_fnd should succed if tab[-1] is same suit as dest.")
    def testWasteToFoundationEmptyBad(self):
        """
        waste_to_foundation(waste : list, fnd_col : list, stock : Deck)
        Returns:
            None

        Empty waste should throw a runtime error
        """
        with self.assertRaises(
                RuntimeError,
                msg="If waste is empty, exception should be thrown when used."
        ):
            # test waste
            test_waste = []
            # test destination foundation with an ace on top
            test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
            proj10.tableau_to_foundation(test_waste, test_fnd_col_dest)
    def testTableauToFoundationRankBad(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Good suit, bad rank.
        """
        with self.assertRaises(
                RuntimeError,
                msg="Pushing a card to fnd requires it to the cards \
rank to be no more than 1 greater than the dest_card."):
            # test source tableau
            test_tab_col_src = [cards.Card(rank=3, suit=1)]
            # test destination foundation with an ace on top
            test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
            proj10.tableau_to_foundation(test_tab_col_src, test_fnd_col_dest)
    def testTableauToFoundationFaceGood(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Good suit, good rank, face up.
        """
        # test source tableau
        test_src_card = cards.Card(rank=2, suit=1)
        if not test_src_card.is_face_up():
            test_src_card.flip_card()
        test_tab_col_src = [test_src_card]
        # test destination foundation with an ace on top
        test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
        proj10.tableau_to_foundation(test_tab_col_src, test_fnd_col_dest)
        self.assertTrue(test_fnd_col_dest[-1] == test_src_card,
                        msg="tab_to_fnd should succeed if tab[-1] is face up.")
    def testTableauToFoundationSuitBad(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Bad suit, good rank.
        """
        with self.assertRaises(
                RuntimeError,
                msg=
                "Pushing a card to fnd requires it to the cards have same suit."
        ):
            # test source tableau
            test_tab_col_src = [cards.Card(rank=2, suit=2)]
            # test destination foundation with an ace on top
            test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
            proj10.tableau_to_foundation(test_tab_col_src, test_fnd_col_dest)
    def testTableauToFoundationFlipLastTabCard(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Card at the bottom of the source tab_col should be flipped up.
        """
        test_tab_col = self.grab_test_tab_col(2)
        # flip the last card and push something that is a valid move
        test_tab_col[-1].flip_card()
        test_tab_col.append(cards.Card(rank=2, suit=1))
        test_fnd = [cards.Card(rank=1, suit=1)]
        proj10.tableau_to_foundation(test_tab_col, test_fnd)
        self.assertTrue(
            test_tab_col[-1].is_face_up(),
            msg=
            "Card at the bottom of a tableau cannot be face down after valid tab_to_fnd move."
        )
    def testTableauToFoundationEmptyPushGood(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        This test ensures pushing an ace to an empty fnd succeeds.
        """
        # test adding ace to empty foundation
        #
        # ace of clubs
        test_card = cards.Card(rank=1, suit=1)
        test_tab = self.grab_test_tab_col(1)
        test_tab.append(test_card)
        test_fnd = []
        proj10.tableau_to_foundation(test_tab, test_fnd)
        self.assertEqual(test_card,
                         test_fnd[-1],
                         msg="Pushing ace to an empty fnd should work fine.")
    def testTableauToFoundationEmptyPushBad(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        This test ensures pushing a card != ace to an empty fnd fails.
        """

        # test empty foundation
        with self.assertRaises(
                RuntimeError,
                msg=
                "Empty foundation should throw error when passing a card that is not an ace."
        ):
            # 2 of clubs
            test_card = cards.Card(rank=2, suit=1)
            test_tab = self.grab_test_tab_col(1)
            test_tab.append(test_card)
            proj10.tableau_to_foundation(test_tab, [])
    def testTableauToFoundationFaceBad(self):
        """
        tableau_to_foundation(tab_col : list, fnd_col : list)
        Returns:
            None

        Bad suit, good rank.
        """
        with self.assertRaises(
                RuntimeError,
                msg=
                "Pushing a card to fnd requires it to the src_card be face up."
        ):
            test_src_card = cards.Card(rank=2, suit=1)
            if test_src_card.is_face_up():
                test_src_card.flip_card()
            # test source tableau
            test_tab_col_src = [test_src_card]
            # test destination foundation with an ace on top
            test_fnd_col_dest = [cards.Card(rank=1, suit=1)]
            proj10.tableau_to_foundation(test_tab_col_src, test_fnd_col_dest)