code: def helper_test_nan(self, metric, **kwargs):
      test_cases, kwargs = self.get_test_cases(**kwargs)
  
      for s1, s2 in test_cases:
          # univariate
          non_nan_metric = metric(s1[:9] + 1, s2[:9])
          nan_s1 = s1.copy()
          nan_s1._xa.values[-1, :, :] = np.nan
          nan_metric = metric(nan_s1 + 1, s2)
          assert non_nan_metric == nan_metric
  
          # multivariate + multi-TS
          s11 = [s1.stack(s1)] * 2
          s22 = [s2.stack(s2)] * 2
          non_nan_metric = metric(
              [s[:9] + 1 for s in s11], [s[:9] for s in s22]
          )
          nan_s11 = s11.copy()
          for s in nan_s11:
              s._xa.values[-1, :, :] = np.nan
          nan_metric = metric([s + 1 for s in nan_s11], s22)
          assert non_nan_metric == nan_metric
  
imports: import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.metrics import metrics
label_desc: Use image node_id 7 for calling the TestMetrics obj's underlying member method code with example usage: obj.helper_test_nan(metric) without return types