code: def test_raise_when_failed_to_deploy_endpoint():
      try:
          sagemaker_session = get_sagemaker_session(
              returns_status="Failed"
          )
          assert sagemaker_session.wait_for_endpoint(ENDPOINT_NAME)
          assert (
              False
          ), "sagemaker.exceptions.UnexpectedStatusException should have been raised but was not"
      except Exception as e:
          assert (
              type(e) == sagemaker.exceptions.UnexpectedStatusException
          )
          assert e.actual_status == "Failed"
          assert "InService" in e.allowed_statuses
  
file_path: sagemaker-python-sdk/tests/unit/test_exception_on_bad_status.py
imports: from __future__ import absolute_import
  import pytest
  from mock import Mock, MagicMock
  import sagemaker
  from sagemaker.session import _check_job_status
label_desc: Use image node_id 8 for calling a global function with example usage: test_raise_when_failed_to_deploy_endpoint() without return types