code: def test_metadata_dtype(dt, fail):
      # gh-14142
      arr = np.ones(10, dtype=dt)
      buf = BytesIO()
      with assert_warns(UserWarning):
          np.save(buf, arr)
      buf.seek(0)
      if fail:
          with assert_raises(ValueError):
              np.load(buf)
      else:
          arr2 = np.load(buf)
          # BUG: assert_array_equal does not check metadata
          from numpy.lib.utils import drop_metadata
  
          assert_array_equal(arr, arr2)
          assert drop_metadata(arr.dtype) is not arr.dtype
          assert drop_metadata(arr2.dtype) is arr2.dtype
  
imports: import sys
  import os
  import warnings
  import pytest
  from io import BytesIO
  import numpy
  from numpy.testing import assert_, assert_array_equal, assert_raises, assert_raises_regex, assert_warns, IS_PYPY, IS_WASM
  from numpy.testing._private.utils import requires_memory
  from numpy.lib import format
  import yatest.common
label_desc: Use image node_id 34 for calling a global function with example usage: test_metadata_dtype(dt, fail) without return types