code: def test_autodetect_coords_from_model(self, use_context):
      pd = pytest.importorskip("pandas")
      df_data = pd.DataFrame(columns=["date"]).set_index("date")
      dates = pd.date_range(start="2020-05-01", end="2020-05-20")
      for city, mu in {
          "Berlin": 15,
          "San Marino": 18,
          "Paris": 16,
      }.items():
          df_data[city] = np.random.normal(loc=mu, size=len(dates))
      df_data.index = dates
      df_data.index.name = "date"
  
      coords = {"date": df_data.index, "city": df_data.columns}
      with pm.Model(coords=coords) as model:
          europe_mean = pm.Normal(
              "europe_mean_temp", mu=15.0, sigma=3.0
          )
          city_offset = pm.Normal(
              "city_offset", mu=0.0, sigma=3.0, dims="city"
          )
          city_temperature = pm.Deterministic(
              "city_temperature", europe_mean + city_offset, dims="city"
          )
  
          data_dims = ("date", "city")
          data = pm.ConstantData("data", df_data, dims=data_dims)
          _ = pm.Normal(
              "likelihood",
              mu=city_temperature,
              sigma=0.5,
              observed=data,
              dims=data_dims,
          )
  
          trace = pm.sample(
              return_inferencedata=False,
              compute_convergence_checks=False,
              cores=1,
              chains=1,
              tune=20,
              draws=30,
              step=pm.Metropolis(),
          )
          if use_context:
              with warnings.catch_warnings():
                  warnings.filterwarnings(
                      "ignore",
                      "More chains .* than draws.*",
                      UserWarning,
                  )
                  idata = to_inference_data(trace=trace)
      if not use_context:
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore", "More chains .* than draws.*", UserWarning
              )
              idata = to_inference_data(trace=trace, model=model)
  
      assert "city" in list(idata.posterior.dims)
      assert "city" in list(idata.observed_data.dims)
      assert "date" in list(idata.observed_data.dims)
  
      np.testing.assert_array_equal(
          idata.posterior.coords["city"], coords["city"]
      )
      np.testing.assert_array_equal(
          idata.observed_data.coords["date"], coords["date"]
      )
      np.testing.assert_array_equal(
          idata.observed_data.coords["city"], coords["city"]
      )
  
imports: import warnings
  from typing import Dict, Tuple
  import numpy
  import pytensor.tensor
  import pytest
  from arviz import InferenceData
  from arviz.tests.helpers import check_multiple_attrs
  from numpy import ma
  from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedIncSubtensor1
  import pymc
  from pymc.backends.arviz import InferenceDataConverter, predictions_to_inference_data, to_inference_data
  from pymc.exceptions import ImputationWarning
label_desc: Use image node_id 10 for calling the TestDataPyMC obj's underlying member method code with example usage: obj.test_autodetect_coords_from_model(use_context) without return types