code: def test_axis_nan_policy_axis_is_None(
      hypotest,
      args,
      kwds,
      n_samples,
      n_outputs,
      paired,
      unpacker,
      nan_policy,
      data_generator,
  ):
      # check for correct behavior when `axis=None`
  
      if not unpacker:
  
          def unpacker(res):
              return res
  
      rng = np.random.default_rng(0)
  
      if data_generator == "empty":
          data = [rng.random((2, 0)) for i in range(n_samples)]
      else:
          data = [rng.random((2, 20)) for i in range(n_samples)]
  
      if data_generator == "mixed":
          masks = [rng.random((2, 20)) > 0.9 for i in range(n_samples)]
          for sample, mask in zip(data, masks):
              sample[mask] = np.nan
      elif data_generator == "all_nans":
          data = [sample * np.nan for sample in data]
  
      data_raveled = [sample.ravel() for sample in data]
  
      if nan_policy == "raise" and data_generator not in {
          "all_finite",
          "empty",
      }:
          message = "The input contains nan values"
  
          # check for correct behavior whether or not data is 1d to begin with
          with pytest.raises(ValueError, match=message):
              hypotest(
                  *data, axis=None, nan_policy=nan_policy, *args, **kwds
              )
          with pytest.raises(ValueError, match=message):
              hypotest(
                  *data_raveled,
                  axis=None,
                  nan_policy=nan_policy,
                  *args,
                  **kwds,
              )
  
      else:
          # behavior of reference implementation with 1d input, hypotest with 1d
          # input, and hypotest with Nd input should match, whether that means
          # that outputs are equal or they raise the same exception
  
          ea_str, eb_str, ec_str = None, None, None
          with np.errstate(divide="ignore", invalid="ignore"):
              try:
                  res1da = nan_policy_1d(
                      hypotest,
                      data_raveled,
                      unpacker,
                      *args,
                      n_outputs=n_outputs,
                      nan_policy=nan_policy,
                      paired=paired,
                      _no_deco=True,
                      **kwds,
                  )
              except (
                  RuntimeWarning,
                  ValueError,
                  ZeroDivisionError,
              ) as ea:
                  ea_str = str(ea)
  
              try:
                  res1db = unpacker(
                      hypotest(
                          *data_raveled,
                          *args,
                          nan_policy=nan_policy,
                          **kwds,
                      )
                  )
              except (
                  RuntimeWarning,
                  ValueError,
                  ZeroDivisionError,
              ) as eb:
                  eb_str = str(eb)
  
              try:
                  res1dc = unpacker(
                      hypotest(
                          *data,
                          *args,
                          axis=None,
                          nan_policy=nan_policy,
                          **kwds,
                      )
                  )
              except (
                  RuntimeWarning,
                  ValueError,
                  ZeroDivisionError,
              ) as ec:
                  ec_str = str(ec)
  
              if ea_str or eb_str or ec_str:
                  assert any(
                      [
                          str(ea_str).startswith(message)
                          for message in too_small_messages
                      ]
                  )
                  assert ea_str == eb_str == ec_str
              else:
                  assert_equal(res1db, res1da)
                  assert_equal(res1dc, res1da)
                  for item in (
                      list(res1da) + list(res1db) + list(res1dc)
                  ):
                      # Most functions naturally return NumPy numbers, which
                      # are drop-in replacements for the Python versions but with
                      # desirable attributes. Make sure this is consistent.
                      assert np.issubdtype(item.dtype, np.number)
  
imports: from itertools import product, combinations_with_replacement, permutations
  import re
  import pickle
  import pytest
  import numpy
  from numpy.testing import assert_allclose, assert_equal, suppress_warnings
  from scipy import stats
  from scipy.stats import norm
  from scipy.stats._axis_nan_policy import _masked_arrays_2_sentinel_arrays
  from scipy._lib._util import AxisError
label_desc: Use image node_id 9 for calling a global function with example usage: test_axis_nan_policy_axis_is_None(hypotest, args, kwds, n_samples, n_outputs, paired, unpacker, nan_policy, data_generator) and returns: res