class test_ask_for_play_again(unittest.TestCase):
    """Check that the correct message prints for a tie"""

    def setUp(self):
        self.controller = Connect_Four_Controller()
        print("Running: ", str(self._testMethodName) + "\n   " + str(self.shortDescription()) + "\n")

    def tearDown(self):
        del self.controller


    @patch('builtins.input', return_value=('y'))
    @patch("sys.stdout",new_callable=StringIO)
    def test_reset_yes(self, mock_output, inputvalue):
        """Test if the player returns yes on play again input"""

        self.controller.game_state.player = 1

        self.controller.check_play_again()

        self.assertEqual(self.controller.game_state.player, -1)
Exemple #2
0
class test_ask_for_play_again(unittest.TestCase):
    """Check that the correct message prints for a tie"""
    def setUp(self):
        self.controller = Connect_Four_Controller()
        print(
            "Running: ",
            str(self._testMethodName) + "\n   " +
            str(self.shortDescription()) + "\n")

    def tearDown(self):
        del self.controller

    @patch('builtins.input', return_value=('y'))
    @patch("sys.stdout", new_callable=StringIO)
    def test_reset_yes(self, mock_output, inputvalue):
        """Test if the player returns yes on play again input"""

        self.controller.game_state.player = 1

        self.controller.check_play_again()

        self.assertEqual(self.controller.game_state.player, -1)