code: def test_io_method(
      self, data, eight_schools_params, store, fill_attrs
  ):
      # create InferenceData and check it has been properly created
      inference_data = self.get_inference_data(  # pylint: disable=W0612
          data, eight_schools_params, fill_attrs
      )
      test_dict = {
          "posterior": ["eta", "theta", "mu", "tau"],
          "posterior_predictive": ["eta", "theta", "mu", "tau"],
          "sample_stats": ["eta", "theta", "mu", "tau"],
          "prior": ["eta", "theta", "mu", "tau"],
          "prior_predictive": ["eta", "theta", "mu", "tau"],
          "sample_stats_prior": ["eta", "theta", "mu", "tau"],
          "observed_data": ["J", "y", "sigma"],
      }
      fails = check_multiple_attrs(test_dict, inference_data)
      assert not fails
  
      if fill_attrs:
          assert inference_data.attrs["test"] == 1
      else:
          assert "test" not in inference_data.attrs
  
      # check filename does not exist and use to_zarr method
      with TemporaryDirectory(prefix="arviz_tests_") as tmp_dir:
          filepath = os.path.join(tmp_dir, "zarr")
  
          # InferenceData method
          if store == 0:
              # Tempdir
              store = inference_data.to_zarr(store=None)
              assert isinstance(store, MutableMapping)
          elif store == 1:
              inference_data.to_zarr(store=filepath)
              # assert file has been saved correctly
              assert os.path.exists(filepath)
              assert os.path.getsize(filepath) > 0
          elif store == 2:
              store = zarr.storage.DirectoryStore(filepath)
              inference_data.to_zarr(store=store)
              # assert file has been saved correctly
              assert os.path.exists(filepath)
              assert os.path.getsize(filepath) > 0
  
          if isinstance(store, MutableMapping):
              inference_data2 = InferenceData.from_zarr(store)
          else:
              inference_data2 = InferenceData.from_zarr(filepath)
  
          # Everything in dict still available in inference_data2 ?
          fails = check_multiple_attrs(test_dict, inference_data2)
          assert not fails
  
          if fill_attrs:
              assert inference_data2.attrs["test"] == 1
          else:
              assert "test" not in inference_data2.attrs
  
file_path: arviz/arviz/tests/base_tests/test_data_zarr.py
imports: import os
  from collections.abc import MutableMapping
  from tempfile import TemporaryDirectory
  from typing import Mapping
  import numpy
  import pytest
  from ...None import InferenceData, from_dict
  from ...None import to_zarr, from_zarr
  from ..helpers import chains, check_multiple_attrs, draws, eight_schools_params, importorskip, running_on_ci
label_desc: Use image node_id 3 for calling the TestDataZarr obj's underlying member method code with example usage: obj.test_io_method(data, eight_schools_params, store, fill_attrs) without return types