code: def test_metadata():
      md = GiftiMetaData(key="value")
      # Old initialization methods
      with pytest.warns(DeprecationWarning) as w:
          nvpair = GiftiNVPairs("key", "value")
      with pytest.warns(FutureWarning) as w:
          md2 = GiftiMetaData(nvpair=nvpair)
      assert len(w) == 1
      with pytest.warns(DeprecationWarning) as w:
          md3 = GiftiMetaData.from_dict({"key": "value"})
      assert md == md2 == md3 == {"key": "value"}
      # .data as a list of NVPairs is going away
      with pytest.warns(DeprecationWarning) as w:
          assert md.data[0].name == "key"
          assert md.data[0].value == "value"
      assert len(w) == 2
  
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 9 for calling a global function with example usage: test_metadata() without return types