コード例 #1
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_get_current_player(self, controller_mock, game_sel):
        game = OXGame()
        game.id = 1

        game.get_current_player()

        controller_mock.assert_called_with(
            '[["method", "get_current_player_ox"], ["id", "1"]]')
コード例 #2
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_make_move(self, controller_mock, game_sel):
        game = OXGame()

        game.id = 1

        game.make_move(3)

        controller_mock.assert_called_with(
            '[["method", "make_move_ox"], ["id", "1"], ["chosen_field", "3"]]')
コード例 #3
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_end_game(self, controller_mock, game_sel):
        game = OXGame()

        game.id = 1

        game.end_game()

        controller_mock.assert_called_with(
            '[["method", "end_game_ox"], ["id", "1"]]')
コード例 #4
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_add_player(self, controller_mock, game_sel):
        game = OXGame()
        game.id = 1

        game.add_player("test", 0)

        controller_mock.assert_called_with(
            '[["method", "add_player_ox"], ["id", "1"], ["player_name", "test"], ["player_number", "0"]]'
        )
コード例 #5
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test__finish_game(self, controller_mock, game_sel):
        game = OXGame()

        game.id = 1
        game._in_game_result = "test"

        game.finish_game()

        controller_mock.assert_called_with(
            '[["method", "end_game_ox"], ["id", "1"]]')
コード例 #6
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_check_game_result_none(self, controller_mock, game_sel):
        controller_mock.return_value = 'False'
        game = OXGame()

        game.id = 1

        result = game.check_game_result()

        self.assertEqual(None, result)
        controller_mock.assert_called_with(
            '[["method", "check_game_result_ox"], ["id", "1"]]')
コード例 #7
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test__perform_next_move(self, controller_mock, game_sel):
        controller_mock.return_value = 'True'
        game = OXGame()

        game.id = 1

        with patch('builtins.input', return_value=1):
            game.perform_next_move()

        controller_mock.assert_called_with(
            '[["method", "check_game_result_ox"], ["id", "1"]]')
コード例 #8
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test__init_players(self, controller_mock, game_sel):
        game = OXGame()

        game.id = 1

        with patch('builtins.input', return_value='test'):
            game.init_players()

        controller_mock.assert_called_with(
            '[["method", "add_player_ox"], ["id", "1"], ["player_name", "test"], ["player_number", "0"]]'
        )
コード例 #9
0
ファイル: test_OXGame.py プロジェクト: phpl/pite_lab3
    def test_play(self, controller_mock, game_sel):
        controller_mock.return_value = 'True'
        game = OXGame()

        game.id = 1

        with patch('builtins.input', return_value=1):
            game.play()

        controller_mock.assert_called_with(
            '[["method", "end_game_ox"], ["id", "1"]]')