code: def test_dataset_imutability(ds, transform):
      ds_c = deepcopy(ds)
  
      # test that using twice the transformation gives the same result
      out1 = transform(ds, is_train=True)
      out2 = transform(ds, is_train=True)
      for o1, o2 in zip(out1, out2):
          for k in o1:
              if isinstance(o1[k], np.ndarray):
                  assert np.allclose(o1[k], o2[k], equal_nan=True)
              else:
                  assert o1[k] == o2[k]
  
      # test that the original dataset did not change due to the transformation
      for d, d_c in zip(ds, ds_c):
          for k in d:
              if isinstance(d[k], np.ndarray):
                  assert np.allclose(d[k], d_c[k], equal_nan=True)
              else:
                  assert d[k] == d_c[k]
  
imports: from copy import deepcopy
  import numpy
  import pandas
  import pytest
  from gluonts.dataset.common import ListDataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.transform import AddAgeFeature, AddConstFeature, AddObservedValuesIndicator
label_desc: Use image node_id 1 for calling a global function with example usage: test_dataset_imutability(ds, transform) without return types