code: def test_algorithm_required_free_text_hyperparameter_not_provided(
      session,
  ):
      session.sagemaker_config = {}
      hyperparameters = [
          {
              "Name": "free_text_hp1",
              "Description": "You can write anything here",
              "Type": "FreeText",
              "IsTunable": False,
              "IsRequired": True,
          },
          {
              "Name": "free_text_hp2",
              "Description": "You can write anything here",
              "Type": "FreeText",
              "IsTunable": False,
              "IsRequired": False,
          },
      ]
  
      some_algo = copy.deepcopy(DESCRIBE_ALGORITHM_RESPONSE)
      some_algo["TrainingSpecification"][
          "SupportedHyperParameters"
      ] = hyperparameters
  
      session.sagemaker_client.describe_algorithm = Mock(
          return_value=some_algo
      )
  
      estimator = AlgorithmEstimator(
          algorithm_arn="arn:aws:sagemaker:us-east-2:1234:algorithm/scikit-decision-trees",
          role="SageMakerRole",
          instance_type="ml.m4.2xlarge",
          instance_count=1,
          sagemaker_session=session,
      )
  
      # Calling fit with unset required hyperparameters should fail
      # this covers the use case of not calling set_hyperparameters() explicitly
      with pytest.raises(ValueError):
          estimator.fit({"training": "s3://some/place"})
  
      # hp1 is required and was not provided
      with pytest.raises(ValueError):
          estimator.set_hyperparameters(free_text_hp2="some text")
  
imports: from __future__ import absolute_import
  import copy
  import datetime
  import pytest
  from mock import Mock, patch
  from sagemaker.algorithm import AlgorithmEstimator
  from sagemaker.estimator import _TrainingJob
  from sagemaker.transformer import Transformer
label_desc: Use image node_id 15 for calling a global function with example usage: test_algorithm_required_free_text_hyperparameter_not_provided(session) without return types