class_docstr: Tests initialization and instance methods of the ``Dataset`` class.
docstr: Test that open() can load an existing dataset
  on disk in read-only mode.
docstr_tok: ["Test","that","open","(",")","can","load","an","existing","dataset","on","disk","in","read-only","mode","."]
code: def test_open_existing_read_only(self, tmp_path):
      """Test that open() can load an existing dataset
      on disk in read-only mode."""
  
      path = Path(tmp_path, "dset.h5")
      existing = Dataset.open(path, mode="w")
      existing.data = "some data"
  
      existing.close()
  
      dset = Dataset.open(path, mode="r")
  
      assert isinstance(dset, Dataset)
      assert Path(dset.bind.filename) == path.absolute()
      assert dset.data == "some data"
  
      with pytest.raises(DatasetNotWriteableError):
          dset.other_data = "some other data"
  
      dset.close()
  
imports: from numbers import Number
  from pathlib import Path
  from typing import ClassVar, Dict
  import numpy
  import pytest
  from pennylane.data import AttributeInfo, Dataset, DatasetJSON, DatasetNotWriteableError, DatasetScalar, attribute, field
  from pennylane.data.base.dataset import UNSET, _init_arg
  from pennylane.data.base.hdf5 import open_group
label_desc: Use image node_id 22 for calling the TestDataset obj's underlying member method code with example usage: obj.test_open_existing_read_only(tmp_path) without return types