code: def test_sweep_pause(runner, mock_server, test_settings, stop_method):
      with runner.isolated_filesystem():
          sweep_config = {
              "name": "My Sweep",
              "method": "grid",
              "parameters": {"parameter1": {"values": [1, 2, 3]}},
          }
          sweep_id = wandb.sweep(sweep_config)
          assert sweep_id == "test"
          assert (
              runner.invoke(cli.sweep, ["--pause", sweep_id]).exit_code
              == 0
          )
          assert (
              runner.invoke(cli.sweep, ["--resume", sweep_id]).exit_code
              == 0
          )
          if stop_method == "stop":
              assert (
                  runner.invoke(
                      cli.sweep, ["--stop", sweep_id]
                  ).exit_code
                  == 0
              )
          else:
              assert (
                  runner.invoke(
                      cli.sweep, ["--cancel", sweep_id]
                  ).exit_code
                  == 0
              )
  
imports: import json
  import pytest
  import wandb
  from wandb.cli import cli
label_desc: Use image node_id 1 for calling a global function with example usage: test_sweep_pause(runner, mock_server, test_settings, stop_method) without return types