code: def test_dataarray_typing(label):
      dtype = data_type_codes.dtype[label]
      code = data_type_codes.code[label]
      arr = np.zeros((5,), dtype=dtype)
  
      # Default interface: accept standards-conformant arrays, reject else
      if dtype in ("uint8", "int32", "float32"):
          assert GiftiDataArray(arr).datatype == code
      else:
          with pytest.raises(ValueError):
              GiftiDataArray(arr)
  
      # Explicit override - permit for now, may want to warn or eventually
      # error
      assert GiftiDataArray(arr, datatype=label).datatype == code
      assert GiftiDataArray(arr, datatype=code).datatype == code
      # Void is how we say we don't know how to do something, so it's not unique
      if dtype != np.dtype("void"):
          assert GiftiDataArray(arr, datatype=dtype).datatype == code
  
      # Side-load data array (as in parsing)
      # We will probably always want this to load legacy images, but it's
      # probably not ideal to make it easy to silently propagate nonconformant
      # arrays
      gda = GiftiDataArray()
      gda.data = arr
      gda.datatype = data_type_codes.code[label]
      assert gda.data.dtype == dtype
      assert gda.datatype == data_type_codes.code[label]
  
imports: import itertools
  import sys
  import warnings
  from io import BytesIO
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nibabel.tmpdirs import InTemporaryDirectory
  from ...None import load
  from ...fileholders import FileHolder
  from ...nifti1 import data_type_codes
  from ...testing import get_test_data
  from ..None import GiftiCoordSystem, GiftiDataArray, GiftiImage, GiftiLabel, GiftiLabelTable, GiftiMetaData, GiftiNVPairs
  from .test_parse_gifti_fast import DATA_FILE1, DATA_FILE2, DATA_FILE3, DATA_FILE4, DATA_FILE5, DATA_FILE6
label_desc: Use image node_id 7 for calling a global function with example usage: test_dataarray_typing(label) without return types