code: def test_var_names(self):
      with Model() as m:
          x = Normal("x")
          y1 = Normal("y1", x, observed=[0, 1, 2])
          y2 = Normal("y2", x, observed=[3, 4])
  
      idata = InferenceData(
          posterior=dict_to_dataset(
              {"x": np.arange(100).reshape(4, 25)}
          )
      )
  
      res_y1 = compute_log_likelihood(
          idata,
          var_names=["y1"],
          extend_inferencedata=False,
          model=m,
          progressbar=False,
      )
      assert res_y1 is not idata
      assert set(res_y1.data_vars) == {"y1"}
      np.testing.assert_allclose(
          res_y1["y1"].values,
          st.norm.logpdf([0, 1, 2], np.arange(100)[:, None]).reshape(
              4, 25, 3
          ),
      )
  
      res_y2 = compute_log_likelihood(
          idata,
          var_names=["y2"],
          extend_inferencedata=False,
          model=m,
          progressbar=False,
      )
      assert res_y2 is not idata
      assert set(res_y2.data_vars) == {"y2"}
      np.testing.assert_allclose(
          res_y2["y2"].values,
          st.norm.logpdf([3, 4], np.arange(100)[:, None]).reshape(
              4, 25, 2
          ),
      )
  
      res_both = compute_log_likelihood(
          idata, model=m, progressbar=False
      )
      assert res_both is idata
      assert set(res_both.log_likelihood.data_vars) == {"y1", "y2"}
      np.testing.assert_allclose(
          res_y1["y1"].values,
          res_both.log_likelihood["y1"].values,
      )
      np.testing.assert_allclose(
          res_y2["y2"].values,
          res_both.log_likelihood["y2"].values,
      )
  
file_path: pymc/tests/stats/test_log_likelihood.py
imports: import numpy
  import pytest
  import scipy.stats
  from arviz import InferenceData, dict_to_dataset, from_dict
  from pymc.distributions import Dirichlet, Normal
  from pymc.distributions.transforms import log
  from pymc.model import Model
  from pymc.stats.log_likelihood import compute_log_likelihood
  from tests.distributions.test_multivariate import dirichlet_logpdf
label_desc: Use image node_id 3 for calling the TestComputeLogLikelihood obj's underlying member method code with example usage: obj.test_var_names() without return types