class_docstr: Test ByteLevelBPE is well-behaved.
class_docstr_tok: ["Test","ByteLevelBPE","is","well-behaved","."]
code: def test_nofile(self):
      pp = ParlaiParser()
      DictionaryAgent.add_cmdline_args(pp, partial_opt=None)
      with self.assertRaises(IOError):
          # did not specify bpe merge or vocab
          DictionaryAgent(
              pp.parse_args(["--dict-tokenizer", "bytelevelbpe"])
          )
  
      with self.assertRaises(IOError):
          # specified one
          DictionaryAgent(
              pp.parse_args(
                  [
                      "--dict-tokenizer",
                      "bytelevelbpe",
                      "--bpe-merge",
                      DEFAULT_BYTELEVEL_BPE_MERGE,
                  ]
              )
          )
  
      with self.assertRaises(IOError):
          # specified the other
          DictionaryAgent(
              pp.parse_args(
                  [
                      "--dict-tokenizer",
                      "bytelevelbpe",
                      "--bpe-vocab",
                      DEFAULT_BYTELEVEL_BPE_VOCAB,
                  ]
              )
          )
  
      with self.assertRaises(IOError):
          # intentionally missing file
          DictionaryAgent(
              pp.parse_args(
                  [
                      "--dict-tokenizer",
                      "bytelevelbpe",
                      "--bpe-merge",
                      "foobar",  # intentionally wrong
                      "--bpe-vocab",
                      DEFAULT_BYTELEVEL_BPE_VOCAB,
                  ]
              )
          )
  
      with self.assertRaises(IOError):
          # intentionally missing file
          DictionaryAgent(
              pp.parse_args(
                  [
                      "--dict-tokenizer",
                      "bytelevelbpe",
                      "--bpe-merge",
                      DEFAULT_BYTELEVEL_BPE_MERGE,
                      "--bpe-vocab",
                      "foobar",  # intentionally wrong
                  ]
              )
          )
  
imports: from parlai.core.build_data import modelzoo_path
  from parlai.core.dict import find_ngrams
  from parlai.core.params import ParlaiParser
  from parlai.core.dict import DictionaryAgent, TokenizationMode
  from parlai.core.opt import Opt
  import parlai.scripts.build_dict
  from parlai.utils.io import PathManager
  import parlai.utils.testing
  import os
  import shutil
  import unittest
  import pytest
label_desc: Use image node_id 3 for calling the TestByteLevelBPE obj's underlying member method code with example usage: obj.test_nofile() without return types