code: def test_switchout(self):
      switchout_cls = get_transforms_cls(["switchout"])["switchout"]
      opt = Namespace(seed=3434, switchout_temperature=0.1)
      switchout_transform = switchout_cls(opt)
      with self.assertRaises(ValueError):
          # require vocabs to warm_up
          switchout_transform.warm_up(vocabs=None)
      vocabs = {
          "src": Namespace(ids_to_tokens=["A", "Fake", "vocab"]),
          "tgt": Namespace(ids_to_tokens=["A", "Fake", "vocab"]),
      }
      switchout_transform.warm_up(vocabs=vocabs)
      ex = {
          "src": ["Hello", ",", "world", "."],
          "tgt": ["Bonjour", "le", "monde", "."],
      }
      # Not apply token mask for not training example
      ex_after = switchout_transform.apply(
          copy.deepcopy(ex), is_train=False
      )
      self.assertEqual(ex_after, ex)
      # apply token mask for training example
      ex_after = switchout_transform.apply(
          copy.deepcopy(ex), is_train=True
      )
      self.assertNotEqual(ex_after, ex)
  
imports: import unittest
  import copy
  import yaml
  import math
  from argparse import Namespace
  from onmt.transforms import get_transforms_cls, get_specials, make_transforms, TransformPipe
  from onmt.transforms.bart import BARTNoising
label_desc: Use image node_id 3 for calling the TestSamplingTransform obj's underlying member method code with example usage: obj.test_switchout() without return types