code: def test_wrapper_from_data():
      # test wrapper from data, wrapper from file
      for dw in (
          didw.wrapper_from_data(DATA),
          didw.wrapper_from_file(DATA_FILE),
      ):
          assert dw.get("InstanceNumber") == 2
          assert dw.get("AcquisitionNumber") == 2
          with pytest.raises(KeyError):
              dw["not an item"]
          assert dw.is_mosaic
          assert_array_almost_equal(
              np.dot(didr.DPCS_TO_TAL, dw.affine), EXPECTED_AFFINE
          )
      for dw in (
          didw.wrapper_from_data(DATA_PHILIPS),
          didw.wrapper_from_file(DATA_FILE_PHILIPS),
      ):
          assert dw.get("InstanceNumber") == 1
          assert dw.get("AcquisitionNumber") == 3
          with pytest.raises(KeyError):
              dw["not an item"]
          assert dw.is_multiframe
      # Another CSA file
      dw = didw.wrapper_from_file(DATA_FILE_SLC_NORM)
      assert dw.is_mosaic
      # Check that multiframe requires minimal set of DICOM tags
      fake_data = dict()
      fake_data["SOPClassUID"] = "1.2.840.10008.5.1.4.1.1.4.2"
      dw = didw.wrapper_from_data(fake_data)
      assert not dw.is_multiframe
      # use the correct SOPClassUID
      fake_data["SOPClassUID"] = "1.2.840.10008.5.1.4.1.1.4.1"
      with pytest.raises(didw.WrapperError):
          didw.wrapper_from_data(fake_data)
      fake_data["PerFrameFunctionalGroupsSequence"] = [None]
      with pytest.raises(didw.WrapperError):
          didw.wrapper_from_data(fake_data)
      fake_data["SharedFunctionalGroupsSequence"] = [None]
      # minimal set should now be met
      dw = didw.wrapper_from_data(fake_data)
      assert dw.is_multiframe
  
imports: import gzip
  from copy import copy
  from decimal import Decimal
  from hashlib import sha1
  from os.path import dirname
  from os.path import join
  from unittest import TestCase
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ...tests.nibabel_data import get_nibabel_data, needs_nibabel_data
  from ...volumeutils import endian_codes
  from ..None import dicomreaders
  from ..None import dicomwrappers
  from .None import dicom_test, have_dicom, pydicom
label_desc: Use image node_id 3 for calling a global function with example usage: test_wrapper_from_data() without return types