code: def test_pyfunc_serve_and_score(spark_model):
      artifact_path = "model"
      with mlflow.start_run():
          mlflow.spark.log_model(spark_model.model, artifact_path)
          model_uri = mlflow.get_artifact_uri(artifact_path)
  
      input_data = pd.DataFrame(
          {"features": spark_model.pandas_df["features"].map(list)}
      )
      resp = pyfunc_serve_and_score_model(
          model_uri,
          data=input_data,
          content_type=pyfunc_scoring_server.CONTENT_TYPE_JSON,
          extra_args=["--env-manager", "local"],
      )
      scores = pd.DataFrame(
          data=json.loads(resp.content.decode("utf-8"))["predictions"]
      ).values.squeeze()
      np.testing.assert_array_almost_equal(
          scores,
          spark_model.model.transform(spark_model.pandas_df)[
              "prediction"
          ].values,
      )
  
imports: import json
  import os
  import numpy
  import pandas
  import pyspark
  import pytest
  from packaging.version import Version
  from pyspark.sql import SparkSession
  from pyspark.sql import functions
  from pyspark.sql.types import LongType
  from sklearn import datasets
  import mlflow
  import mlflow.pyfunc.scoring_server
  from mlflow import pyfunc
  from mlflow.pyfunc import spark_udf
  from tests.helper_functions import pyfunc_serve_and_score_model
  from tests.pyfunc.test_spark import score_model_as_udf
  from tests.spark.test_spark_model_export import SparkModelWithData
label_desc: Use image node_id 10 for calling a global function with example usage: test_pyfunc_serve_and_score(spark_model) without return types