code: def test_TypeError_initialize_weights_when_weight_func_is_not_a_Callable_or_dict(
      forecaster_name,
  ):
      """
      Test TypeError is raised when weight_func is not a Callable or a dict.
      """
      weight_func = "not_Callable_or_dict"
      err_msg = re.escape(
          f"Argument `weight_func` must be a Callable or a dict of Callables. Got {type(weight_func)}."
      )
      with pytest.raises(TypeError, match=err_msg):
          initialize_weights(
              forecaster_name=forecaster_name,
              regressor=LinearRegression(),
              weight_func=weight_func,
              series_weights=None,
          )
  
file_path: skforecast/skforecast/utils/tests/test_initialize_weights.py
imports: import re
  import pytest
  import numpy
  import pandas
  import inspect
  from skforecast.exceptions import IgnoredArgumentWarning
  from skforecast.utils.utils import initialize_weights
  from sklearn.linear_model import LinearRegression
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.neighbors import KNeighborsRegressor
label_desc: Use image node_id 2 for calling a global function with example usage: test_TypeError_initialize_weights_when_weight_func_is_not_a_Callable_or_dict(forecaster_name) without return types