code: def test_wait_returns_error_code_when_experiment_errors(
      auth_mock: unittest.mock.MagicMock,
      requests_mock: mock.Mocker,
  ) -> None:
      auth_mock.return_value = mock_det_auth()
      exp = api_responses.sample_get_experiment(
          id=1, state=bindings.experimentv1State.COMPLETED
      )
      args = CliArgs(master="http://localhost:8888", experiment_id=1)
      exp.experiment.state = bindings.experimentv1State.ERROR
      requests_mock.get(
          f"/api/v1/experiments/{args.experiment_id}",
          status_code=200,
          json=exp.to_json(),
      )
      with pytest.raises(SystemExit) as e:
          determined.cli.experiment.wait(args)
      assert e.value.code == 1
  
file_path: determined/harness/tests/cli/test_experiment.py
imports: import dataclasses
  import unittest.mock
  import pytest
  import requests_mock
  import determined
  import determined.cli
  from determined.common import constants
  from determined.common.api import bindings, certs
  from determined.common.api.authentication import Authentication
  from tests.fixtures import api_responses
label_desc: Use image node_id 2 for calling a global function with example usage: test_wait_returns_error_code_when_experiment_errors(auth_mock, requests_mock) without return types