class_docstr: Base class for testing proxy APIs
  
  Assumes that real classes will provide an `obj_params` method which is a
  generator returning 2 tuples of (<proxy_maker>, <param_dict>).
  <proxy_maker> is a function returning a 3 tuple of (<proxy>, <fileobj>,
  <header>).  <param_dict> is a dictionary containing at least keys
  ``arr_out`` (expected output array from proxy), ``dtype_out`` (expected
  output dtype for array) and ``shape`` (shape of array).
  
  The <header> above should support at least "get_data_dtype",
  "set_data_dtype", "get_data_shape", "set_data_shape"
code: def validate_array_interface_with_dtype(self, pmaker, params):
      # Check proxy returns expected array from asarray
      prox, fio, hdr = pmaker()
      orig = np.array(prox, dtype=None)
      assert_array_equal(orig, params["arr_out"])
      assert_dt_equal(orig.dtype, params["dtype_out"])
  
      context = None
      if np.issubdtype(orig.dtype, np.complexfloating):
          context = clear_and_catch_warnings()
          context.__enter__()
          warnings.simplefilter("ignore", ComplexWarning)
  
      for dtype in sctypes["float"] + sctypes["int"] + sctypes["uint"]:
          # Directly coerce with a dtype
          direct = dtype(prox)
          # Half-precision is imprecise. Obviously. It's a bad idea, but don't break
          # the test over it.
          rtol = 1e-03 if dtype == np.float16 else 1e-05
          assert_allclose(
              direct, orig.astype(dtype), rtol=rtol, atol=1e-08
          )
          assert_dt_equal(direct.dtype, np.dtype(dtype))
          assert direct.shape == params["shape"]
          # All three methods should produce equivalent results
          for arrmethod in (np.array, np.asarray, np.asanyarray):
              out = arrmethod(prox, dtype=dtype)
              assert_array_equal(out, direct)
              assert_dt_equal(out.dtype, np.dtype(dtype))
              # Shape matches expected shape
              assert out.shape == params["shape"]
  
      if context is not None:
          context.__exit__()
  
imports: import unittest
  import warnings
  from io import BytesIO
  from itertools import product
  from os.path import join
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from ..None import ecat, minc1, minc2, parrec
  from ..analyze import AnalyzeHeader
  from ..arrayproxy import ArrayProxy, is_proxy
  from ..casting import have_binary128, sctypes
  from ..externals.netcdf import netcdf_file
  from ..freesurfer.mghformat import MGHHeader
  from ..nifti1 import Nifti1Header
  from ..optpkg import optional_package
  from ..spm2analyze import Spm2AnalyzeHeader
  from ..spm99analyze import Spm99AnalyzeHeader
  from ..testing import assert_dt_equal, clear_and_catch_warnings
  from ..testing import data_path
  from ..tmpdirs import InTemporaryDirectory
  from ..volumeutils import apply_read_scaling
  from .test_api_validators import ValidateAPI
  from .test_parrec import EG_REC, VARY_REC
label_desc: Use image node_id 5 for calling the _TestProxyAPI obj's underlying member method code with example usage: obj.validate_array_interface_with_dtype(pmaker, params) without return types