code: def test_pyonmttok_bpe(self):
      onmttok_cls = get_transforms_cls(["onmt_tokenize"])[
          "onmt_tokenize"
      ]
      base_opt = copy.copy(self.base_opts)
      base_opt["src_subword_type"] = "bpe"
      base_opt["tgt_subword_type"] = "bpe"
      onmt_args = "{'mode': 'space', 'joiner_annotate': True}"
      base_opt["src_onmttok_kwargs"] = onmt_args
      base_opt["tgt_onmttok_kwargs"] = onmt_args
      base_opt["gpt2_pretok"] = False
      opt = Namespace(**base_opt)
      onmttok_cls._validate_options(opt)
      onmttok_transform = onmttok_cls(opt)
      onmttok_transform.warm_up()
      ex = {
          "src": ["Hello", "world", "."],
          "tgt": ["Bonjour", "le", "monde", "."],
      }
      onmttok_transform.apply(ex, is_train=True)
      ex_gold = {
          "src": ["H￭", "ell￭", "o", "world", "."],
          "tgt": ["B￭", "on￭", "j￭", "our", "le", "mon￭", "de", "."],
      }
      self.assertEqual(ex, ex_gold)
  
      # Test mask location
      ex = {
          "src": (
              "### Instruction: ｟newline｠instruction｟newline｠｟newline｠"
              "### Response : ｟newline｠｟_mask_before_｠response"
          ),
          "tgt": "",
      }
      ex["src"] = ex["src"].split(" ")
      ex_gold = {
          "src": [
              "#￭",
              "#￭",
              "#",
              "In￭",
              "struc￭",
              "tion￭",
              ":",
              "\n￭",
              "in￭",
              "struc￭",
              "tion￭",
              "\n￭",
              "\n￭",
              "#￭",
              "#￭",
              "#",
              "R￭",
              "es￭",
              "p￭",
              "on￭",
              "se",
              ":",
              "\n",
              "<blank>",
              "respon￭",
              "se",
          ],
          "tgt": [],
      }
      onmttok_transform.apply(ex, is_train=True)
      self.assertEqual(ex, ex_gold)
  
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 4 for calling the TestSubwordTransform obj's underlying member method code with example usage: obj.test_pyonmttok_bpe() without return types