code: def _test_selection_method(method: str):
      agent1 = autogen.ConversableAgent(
          "alice",
          max_consecutive_auto_reply=10,
          human_input_mode="NEVER",
          llm_config=False,
          default_auto_reply="This is alice speaking.",
      )
      agent2 = autogen.ConversableAgent(
          "bob",
          max_consecutive_auto_reply=10,
          human_input_mode="NEVER",
          llm_config=False,
          default_auto_reply="This is bob speaking.",
      )
      agent3 = autogen.ConversableAgent(
          "charlie",
          max_consecutive_auto_reply=10,
          human_input_mode="NEVER",
          llm_config=False,
          default_auto_reply="This is charlie speaking.",
      )
  
      groupchat = autogen.GroupChat(
          agents=[agent1, agent2, agent3],
          messages=[],
          max_round=6,
          speaker_selection_method=method,
          allow_repeat_speaker=False if method == "manual" else True,
      )
      group_chat_manager = autogen.GroupChatManager(
          groupchat=groupchat, llm_config=False
      )
  
      if method == "round_robin":
          agent1.initiate_chat(
              group_chat_manager, message="This is alice speaking."
          )
          assert len(agent1.chat_messages[group_chat_manager]) == 6
          assert len(groupchat.messages) == 6
          assert [
              msg["content"]
              for msg in agent1.chat_messages[group_chat_manager]
          ] == [
              "This is alice speaking.",
              "This is bob speaking.",
              "This is charlie speaking.",
          ] * 2
      elif method == "auto":
          agent1.initiate_chat(
              group_chat_manager, message="This is alice speaking."
          )
          assert len(agent1.chat_messages[group_chat_manager]) == 6
          assert len(groupchat.messages) == 6
      elif method == "random":
          agent1.initiate_chat(
              group_chat_manager, message="This is alice speaking."
          )
          assert len(agent1.chat_messages[group_chat_manager]) == 6
          assert len(groupchat.messages) == 6
      elif method == "manual":
          for user_input in ["", "q", "x", "1", "10"]:
              with mock.patch.object(
                  builtins, "input", lambda _: user_input
              ):
                  group_chat_manager.reset()
                  agent1.reset()
                  agent2.reset()
                  agent3.reset()
                  agent1.initiate_chat(
                      group_chat_manager,
                      message="This is alice speaking.",
                  )
                  if user_input == "1":
                      assert (
                          len(agent1.chat_messages[group_chat_manager])
                          == 6
                      )
                      assert len(groupchat.messages) == 6
                      assert [
                          msg["content"]
                          for msg in agent1.chat_messages[
                              group_chat_manager
                          ]
                      ] == [
                          "This is alice speaking.",
                          "This is bob speaking.",
                          "This is alice speaking.",
                          "This is bob speaking.",
                          "This is alice speaking.",
                          "This is bob speaking.",
                      ]
                  else:
                      assert (
                          len(agent1.chat_messages[group_chat_manager])
                          == 6
                      )
                      assert len(groupchat.messages) == 6
      elif method == "wrong":
          with pytest.raises(ValueError):
              agent1.initiate_chat(
                  group_chat_manager, message="This is alice speaking."
              )
  
file_path: autogen/test/agentchat/test_groupchat.py
imports: import pytest
  from unittest import mock
  import builtins
  import autogen
  import json
label_desc: Use image node_id 3 for calling a global function with example usage: _test_selection_method(method) without return types