code: def test_merge_environment_with_duplicates():
      expected_mlflow_version = _mlflow_major_version_string()
      duplicate_dependency = "numpy==1.19.2"
  
      # Introduce the duplicate in both environments
      test_shap_env = {
          "channels": ["conda-forge"],
          "dependencies": [
              "python=3.8.5",
              "pip",
              {
                  "pip": [
                      expected_mlflow_version,
                      "shap==0.38.0",
                      duplicate_dependency,
                  ]
              },
          ],
      }
  
      test_model_env = {
          "channels": ["conda-forge"],
          "dependencies": [
              "python=3.8.5",
              "pip",
              {
                  "pip": [
                      expected_mlflow_version,
                      "scikit-learn==0.24.0",
                      "cloudpickle==1.6.0",
                      duplicate_dependency,
                  ]
              },
          ],
      }
  
      # The expected merged environment should not have duplicates
      expected_merged_env = {
          "name": "mlflow-env",
          "channels": ["conda-forge"],
          "dependencies": [
              f"python={PYTHON_VERSION}",
              "pip",
              {
                  "pip": [
                      expected_mlflow_version,
                      "scikit-learn==0.24.0",
                      "cloudpickle==1.6.0",
                      "shap==0.38.0",
                      duplicate_dependency,
                  ]
              },
          ],
      }
  
      actual_merged_env = mlflow.shap._merge_environments(
          test_shap_env, test_model_env
      )
  
      assert sorted(expected_merged_env["channels"]) == sorted(
          actual_merged_env["channels"]
      )
  
      (
          expected_conda_deps,
          expected_pip_deps,
      ) = mlflow.shap._get_conda_and_pip_dependencies(
          expected_merged_env
      )
      (
          actual_conda_deps,
          actual_pip_deps,
      ) = mlflow.shap._get_conda_and_pip_dependencies(actual_merged_env)
  
      # Check that there are no duplicates in the actual pip dependencies
      assert sorted(actual_pip_deps) == sorted(set(actual_pip_deps))
      assert sorted(expected_pip_deps) == actual_pip_deps
      assert sorted(expected_conda_deps) == actual_conda_deps
  
imports: import json
  from unittest import mock
  import numpy
  import pandas
  import pytest
  import shap
  import sklearn
  from numba import njit
  from packaging.version import Version
  from sklearn.datasets import fetch_california_housing, load_diabetes
  import mlflow
  import mlflow.pyfunc.scoring_server
  from mlflow import MlflowClient
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri
  from mlflow.utils import PYTHON_VERSION
  from mlflow.utils.model_utils import _get_flavor_configuration
  from tests.helper_functions import _assert_pip_requirements, _compare_logged_code_paths, _mlflow_major_version_string, pyfunc_serve_and_score_model
label_desc: Use image node_id 9 for calling a global function with example usage: test_merge_environment_with_duplicates() without return types