code: def test_selection(test_images, tmp_path, examples):
      dname1, dname2, fname1, fname2 = examples
  
      # Test that DICOM can examine file
      F = iio.formats.search_read_format(core.Request(fname1, "ri"))
      assert F.name == "DICOM"
      assert isinstance(F, type(iio.formats["DICOM"]))
  
      # Test that we cannot save
      request = core.Request(tmp_path / "test.dcm", "wi")
      assert not F.can_write(request)
  
      # Test fail on wrong file
      fname2 = fname1 + ".fake"
      bb = open(fname1, "rb").read()
      bb = bb[:128] + b"XXXX" + bb[132:]
      open(fname2, "wb").write(bb)
      with pytest.raises(Exception):
          F.get_reader(core.Request(fname2, "ri"))
  
      # Test special files with other formats
      im = iio.imread(test_images / "dicom_file01.dcm")
      assert im.shape == (512, 512)
      im = iio.imread(test_images / "dicom_file03.dcm")
      assert im.shape == (512, 512)
      im = iio.imread(test_images / "dicom_file04.dcm")
      assert im.shape == (512, 512)
  
      # Expected fails
      fname = test_images / "dicom_file90.dcm"
      with pytest.raises(RuntimeError):
          iio.imread(fname)  # 1.2.840.10008.1.2.4.91
      fname = test_images / "dicom_file91.dcm"
      with pytest.raises(RuntimeError):
          iio.imread(fname)  # not pixel data
  
      # This one *should* work, but does not, see issue #18
      try:
          iio.imread(test_images / "dicom_file02.dcm")
      except Exception:
          pass
  
file_path: imageio/tests/test_dicom.py
imports: from zipfile import ZipFile
  import numpy
  import pytest
  import imageio.v2
  import imageio.v3
  from imageio import core
  import imageio.plugins.dicom
  from conftest import deprecated_test
label_desc: Use image node_id 4 for calling a global function with example usage: test_selection(test_images, tmp_path, examples) without return types