code: def test_NaNLabelEncoder_add():
      encoder = NaNLabelEncoder(add_nan=False)
      encoder.fit(np.array(["a", "b", "c"]))
      encoder2 = deepcopy(encoder)
      encoder2.fit(np.array(["d"]))
      assert (
          encoder2.transform(np.array(["a"]))[0] == 0
      ), "a must be encoded as 0"
      assert (
          encoder2.transform(np.array(["d"]))[0] == 3
      ), "d must be encoded as 3"
  
file_path: pytorch-forecasting/tests/test_data/test_encoders.py
imports: from copy import deepcopy
  import itertools
  import numpy
  import pandas
  import pytest
  from sklearn.utils.validation import NotFittedError, check_is_fitted
  import torch
  from pytorch_forecasting.data import EncoderNormalizer, GroupNormalizer, MultiNormalizer, NaNLabelEncoder, TorchNormalizer
label_desc: Use image node_id 2 for calling a global function with example usage: test_NaNLabelEncoder_add() without return types