code: def test_AddObservedIndicator():
      """
      Tests the different methods to impute missing values.
      """
  
      array_values = [
          np.array(
              [np.nan, 1.0, 1.0, np.nan, 2.0, np.nan, 1.0, np.nan]
          ),
          np.array([np.nan]),
          np.array([np.nan, np.nan, np.nan, np.nan, np.nan]),
          np.array([10.0]),
      ]
  
      l_methods = [
          "dummy_value",
          "mean",
          "causal_mean",
          "last_value",
          "rolling_mean1",
          "rolling_mean10",
      ]
  
      d_method_instances = {
          "dummy_value": DummyValueImputation(),
          "mean": MeanValueImputation(),
          "causal_mean": CausalMeanValueImputation(),
          "last_value": LastValueImputation(),
          "rolling_mean1": RollingMeanValueImputation(1),
          "rolling_mean10": RollingMeanValueImputation(10),
      }
  
      d_expected_results = {
          "dummy_value": [
              np.array([0.0, 1.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
          "mean": [
              np.array([1.25, 1.0, 1.0, 1.25, 2.0, 1.25, 1.0, 1.25]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
          "causal_mean": [
              np.array([1.0, 1.0, 1.0, 1.0, 2.0, 1.2, 1.0, 9 / 7]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
          "last_value": [
              np.array([1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
          "rolling_mean10": [
              np.array([1.0, 1.0, 1.0, 1.0, 2.0, 1.1, 1.0, 1.2]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
          "rolling_mean1": [
              np.array([1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0]),
              np.array([0.0]),
              np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
              np.array([10.0]),
          ],
      }
  
      expected_missindicators = [
          np.array([0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0]),
          np.array([0.0]),
          np.array([0.0, 0.0, 0.0, 0.0, 0.0]),
          np.array([1.0]),
      ]
  
      for i, array_value in enumerate(array_values):
          for method in l_methods:
              transfo = transform.AddObservedValuesIndicator(
                  target_field=FieldName.TARGET,
                  output_field=FieldName.OBSERVED_VALUES,
                  imputation_method=d_method_instances[method],
              )
  
              d = {"target": array_value.copy()}
  
              res = transfo.transform(d)
  
              assert np.array_equal(
                  d_expected_results[method][i], res["target"]
              )
              assert np.array_equal(
                  expected_missindicators[i],
                  res[FieldName.OBSERVED_VALUES],
              )
  
imports: from typing import Tuple, List
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  import pytest
  import gluonts
  from gluonts import time_feature, transform
  from gluonts.core import fqname_for
  from gluonts.core.serde import dump_json, load_json
  from gluonts.dataset.common import DataEntry, ListDataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.stat import ScaleHistogram, calculate_dataset_statistics
  from gluonts.transform import CausalMeanValueImputation, DummyValueImputation, LastValueImputation, MeanValueImputation, RollingMeanValueImputation, Valmap
  from gluonts.transform.convert import ToIntervalSizeFormat, erf, erfinv
  from gluonts.transform.feature import CountTrailingZeros
label_desc: Use image node_id 23 for calling a global function with example usage: test_AddObservedIndicator() without return types