code: def test_effective_sample_size_nan(
      self, method, relative, chain, draw, use_nan
  ):
      data = (
          np.random.randn(draw)
          if chain is None
          else np.random.randn(chain, draw)
      )
      if use_nan:
          data[0] = np.nan
      if method in ("quantile", "tail"):
          ess_value = ess(
              data, method=method, prob=0.34, relative=relative
          )
      elif method == "local":
          ess_value = ess(
              data, method=method, prob=(0.2, 0.3), relative=relative
          )
      else:
          ess_value = ess(data, method=method, relative=relative)
      if (draw < 4) or use_nan:
          assert np.isnan(ess_value)
      else:
          assert not np.isnan(ess_value)
      # test following only once tests are run
      if (
          (method == "bulk")
          and (not relative)
          and (chain is None)
          and (draw == 4)
      ):
          if use_nan:
              assert np.isnan(_ess(data))
          else:
              assert not np.isnan(_ess(data))
  
imports: import os
  import numpy
  import packaging
  import pandas
  import pytest
  import scipy
  from numpy.testing import assert_almost_equal
  from ...data import from_cmdstan, load_arviz_data
  from ...rcparams import rcParams
  from ...sel_utils import xarray_var_iter
  from ...stats import bfmi, ess, mcse, rhat
  from ...stats.diagnostics import _ess, _ess_quantile, _mc_error, _mcse_quantile, _multichain_statistics, _rhat, _rhat_rank, _split_chains, _z_scale, ks_summary
label_desc: Use image node_id 13 for calling the TestDiagnostics obj's underlying member method code with example usage: obj.test_effective_sample_size_nan(method, relative, chain, draw, use_nan) without return types