docstr: Check coords and dims from model object can be partially overwritten.
docstr_tok: ["Check","coords","and","dims","from","model","object","can","be","partially","overwritten","."]
code: def test_overwrite_model_coords_dims(self):
      """Check coords and dims from model object can be partially overwritten."""
      dim1 = ["a", "b"]
      new_dim1 = ["c", "d"]
      coords = {"dim1": dim1, "dim2": ["c1", "c2"]}
      x_data = np.arange(4).reshape((2, 2))
      y = x_data + np.random.normal(size=(2, 2))
      with pm.Model(coords=coords):
          x = pm.ConstantData("x", x_data, dims=("dim1", "dim2"))
          beta = pm.Normal("beta", 0, 1, dims="dim1")
          _ = pm.Normal(
              "obs", x * beta, 1, observed=y, dims=("dim1", "dim2")
          )
          trace = pm.sample(100, tune=100, return_inferencedata=False)
          idata1 = to_inference_data(trace)
          idata2 = to_inference_data(
              trace, coords={"dim1": new_dim1}, dims={"beta": ["dim2"]}
          )
  
      test_dict = {
          "posterior": ["beta"],
          "observed_data": ["obs"],
          "constant_data": ["x"],
      }
      fails1 = check_multiple_attrs(test_dict, idata1)
      assert not fails1
      fails2 = check_multiple_attrs(test_dict, idata2)
      assert not fails2
      assert "dim1" in list(idata1.posterior.beta.dims)
      assert "dim2" in list(idata2.posterior.beta.dims)
      assert np.all(
          idata1.constant_data.x.dim1.values == np.array(dim1)
      )
      assert np.all(
          idata1.constant_data.x.dim2.values == np.array(["c1", "c2"])
      )
      assert np.all(
          idata2.constant_data.x.dim1.values == np.array(new_dim1)
      )
      assert np.all(
          idata2.constant_data.x.dim2.values == np.array(["c1", "c2"])
      )
  
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 11 for calling the TestDataPyMC obj's underlying member method code with example usage: obj.test_overwrite_model_coords_dims() without return types