def test_get_player_name(self, mock_input):
        self.assertEqual(ioutil.get_player_name(1), " Ćrt\n9え")

        # brute force way: (don't do this)
        ioutil.input = lambda *args: "Luke"
        self.assertEqual(ioutil.get_player_name(1), "Luke")
        ioutil.input = input
    def test_get_player_name(self, mock_input):
        self.assertEqual(ioutil.get_player_name(1), ' Ćrt\n9え')

        # brute force way: (don't do this)
        ioutil.input = lambda *args: 'Luke'
        self.assertEqual(ioutil.get_player_name(1), 'Luke')
        ioutil.input = input
예제 #3
0
    def setup(self):
        """Performs game setup.

        This function repeatedly asks for ``num_of_players`` player names and
        their symbols. In further development, more setup tasks may be performed
        here.
        """
        for i in range(self.num_of_players):
            name = ioutil.get_player_name(i+1)
            symb = ioutil.get_player_symbol(input, i+1)
            self.players.append(player.Player(name, symb))