code: def test_get_safe_url(mock_url_for, app, test_url, expected_url):
      mock_url_for.return_value = "/home"
      with app.test_request_context(base_url="http://localhost:8080"):
          assert get_safe_url(test_url) == expected_url
  
imports: from __future__ import annotations
  import os
  import re
  from unittest import mock
  import pytest
  from airflow.configuration import initialize_config, write_default_airflow_configuration_if_needed, write_webserver_configuration_if_needed
  from airflow.plugins_manager import AirflowPlugin, EntryPointSource
  from airflow.utils.task_group import TaskGroup
  from airflow.www.views import get_key_paths, get_safe_url, get_task_stats_from_query, get_value_from_path
  from tests.test_utils.config import conf_vars
  from tests.test_utils.mock_plugins import mock_plugin_manager
  from tests.test_utils.www import check_content_in_response, check_content_not_in_response
label_desc: Use image node_id 13 for calling a global function with example usage: test_get_safe_url(mock_url_for, app, test_url, expected_url) without return types