code: def test_raw(pdf, config, hs, exported, tmp_path):
      """Test bti conversion to Raw object."""
      # rx = 2 if 'linux' in pdf else 0
      pytest.raises(
          ValueError, read_raw_bti, pdf, "eggs", preload=False
      )
      pytest.raises(
          ValueError, read_raw_bti, pdf, config, "spam", preload=False
      )
      tmp_raw_fname = tmp_path / "tmp_raw.fif"
      ex = read_raw_fif(exported, preload=True)
      ra = read_raw_bti(pdf, config, hs, preload=False)
      assert "RawBTi" in repr(ra)
      assert_equal(ex.ch_names[:NCH], ra.ch_names[:NCH])
      assert_array_almost_equal(
          ex.info["dev_head_t"]["trans"],
          ra.info["dev_head_t"]["trans"],
          7,
      )
      assert len(ex.info["dig"]) in (3563, 5154)
      assert_dig_allclose(ex.info, ra.info, limit=100)
      coil1, coil2 = (
          np.concatenate(
              [d["loc"].flatten() for d in r_.info["chs"][:NCH]]
          )
          for r_ in (ra, ex)
      )
      assert_array_almost_equal(coil1, coil2, 7)
  
      loc1, loc2 = (
          np.concatenate(
              [d["loc"].flatten() for d in r_.info["chs"][:NCH]]
          )
          for r_ in (ra, ex)
      )
      assert_allclose(loc1, loc2)
  
      assert_allclose(ra[:NCH][0], ex[:NCH][0])
      assert_array_equal(
          [c["range"] for c in ra.info["chs"][:NCH]],
          [c["range"] for c in ex.info["chs"][:NCH]],
      )
      assert_array_equal(
          [c["cal"] for c in ra.info["chs"][:NCH]],
          [c["cal"] for c in ex.info["chs"][:NCH]],
      )
      assert_array_equal(ra._cals[:NCH], ex._cals[:NCH])
  
      # check our transforms
      for key in ("dev_head_t", "dev_ctf_t", "ctf_head_t"):
          if ex.info[key] is None:
              pass
          else:
              assert ra.info[key] is not None
              for ent in ("to", "from", "trans"):
                  assert_allclose(ex.info[key][ent], ra.info[key][ent])
  
      # MNE-BIDS needs these
      for key in ("pdf_fname", "config_fname", "head_shape_fname"):
          assert os.path.isfile(ra._raw_extras[0][key])
  
      ra.save(tmp_raw_fname)
      re = read_raw_fif(tmp_raw_fname)
      print(re)
      for key in ("dev_head_t", "dev_ctf_t", "ctf_head_t"):
          assert isinstance(re.info[key], dict)
          this_t = re.info[key]["trans"]
          assert_equal(this_t.shape, (4, 4))
          # check that matrix by is not identity
          assert not np.allclose(this_t, np.eye(4))
  
imports: import os
  from collections import Counter
  from functools import partial, reduce
  from io import BytesIO
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  import mne
  from mne import pick_info, pick_types
  from mne._fiff._digitization import _make_bti_dig_points
  from mne._fiff.constants import FIFF
  from mne.datasets import testing
  from mne.io import read_raw_bti, read_raw_fif
  from mne.io.bti.bti import _check_nan_dev_head_t, _convert_coil_trans, _correct_trans, _get_bti_dev_t, _get_bti_info, _loc_to_coil_trans, _read_bti_header, _read_config, _read_head_shape, _rename_channels
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.transforms import Transform, combine_transforms, invert_transform
  from mne.utils import assert_dig_allclose
label_desc: Use image node_id 6 for calling a global function with example usage: test_raw(pdf, config, hs, exported, tmp_path) without return types