code: def test_process_form_extras_both(
      mock_pm_hooks, mock_import_str, field_name
  ):
      """
      Test the handling of connection parameters set with the classic `Extra` field as well as custom fields.
      The key used in the field definition returned by `get_connection_form_widgets` is stored in
      attr `extra_field_name_mapping`.  Whatever is defined there is what should end up in `extra` when
      the form is processed.
      """
      mock_pm_hooks.get.return_value = (
          True  # ensure that hook appears registered
      )
  
      # Testing parameters set in both `Extra` and custom fields.
      mock_form = mock.Mock()
      mock_form.data = {
          "conn_type": "test",
          "conn_id": "extras_test",
          "extra": '{"param1": "param1_val"}',
          "extra__test__custom_field": "custom_field_val",
          "extra__other_conn_type__custom_field": "another_field_val",
      }
  
      cmv = ConnectionModelView()
      cmv._iter_extra_field_names_and_sensitivity = mock.Mock(
          return_value=[
              ("extra__test__custom_field", field_name, False)
          ]
      )
      cmv.process_form(form=mock_form, is_created=True)
      assert json.loads(mock_form.extra.data) == {
          field_name: "custom_field_val",
          "param1": "param1_val",
      }
  
imports: from __future__ import annotations
  import json
  from typing import Any
  from unittest import mock
  from unittest.mock import PropertyMock
  import pytest
  from airflow.models import Connection
  from airflow.utils.session import create_session
  from airflow.www.views import ConnectionFormWidget, ConnectionModelView
  from tests.test_utils.www import _check_last_log, _check_last_log_masked_connection, check_content_in_response
label_desc: Use image node_id 11 for calling a global function with example usage: test_process_form_extras_both(mock_pm_hooks, mock_import_str, field_name) without return types