code: def test_init(self):
      tmp_dir = tempfile.TemporaryDirectory()
  
      # create dummy data
      dict_file = osp.join(tmp_dir.name, "fake_chars.txt")
      create_dummy_dict_file(dict_file)
      # with start
      dict_gen = Dictionary(
          dict_file=dict_file,
          with_start=True,
          with_end=True,
          same_start_end=False,
          with_padding=True,
          with_unknown=True,
      )
      self.assertEqual(dict_gen.num_classes, 40)
      self.assertListEqual(
          dict_gen.dict,
          list("0123456789abcdefghijklmnopqrstuvwxyz")
          + ["<BOS>", "<EOS>", "<PAD>", "<UKN>"],
      )
      dict_gen = Dictionary(
          dict_file=dict_file,
          with_start=True,
          with_end=True,
          same_start_end=True,
          with_padding=True,
          with_unknown=True,
      )
      assert dict_gen.num_classes == 39
      assert dict_gen.dict == list(
          "0123456789abcdefghijklmnopqrstuvwxyz"
      ) + ["<BOS/EOS>", "<PAD>", "<UKN>"]
      self.assertEqual(dict_gen.num_classes, 39)
      self.assertListEqual(
          dict_gen.dict,
          list("0123456789abcdefghijklmnopqrstuvwxyz")
          + ["<BOS/EOS>", "<PAD>", "<UKN>"],
      )
      dict_gen = Dictionary(
          dict_file=dict_file,
          with_start=True,
          with_end=True,
          same_start_end=False,
          with_padding=True,
          with_unknown=True,
          start_token="<STA>",
          end_token="<END>",
          padding_token="<BLK>",
          unknown_token="<NO>",
      )
      assert dict_gen.num_classes == 40
      assert dict_gen.dict[-4:] == ["<STA>", "<END>", "<BLK>", "<NO>"]
      self.assertEqual(dict_gen.num_classes, 40)
      self.assertListEqual(
          dict_gen.dict[-4:], ["<STA>", "<END>", "<BLK>", "<NO>"]
      )
      dict_gen = Dictionary(
          dict_file=dict_file,
          with_start=True,
          with_end=True,
          same_start_end=True,
          with_padding=True,
          with_unknown=True,
          start_end_token="<BE>",
      )
      self.assertEqual(dict_gen.num_classes, 39)
      self.assertListEqual(
          dict_gen.dict[-3:], ["<BE>", "<PAD>", "<UKN>"]
      )
      # test len(line) > 1
      create_dummy_dict_file(dict_file, chars=["12", "3", "4"])
      with self.assertRaises(ValueError):
          dict_gen = Dictionary(dict_file=dict_file)
  
      # test duplicated dict
      create_dummy_dict_file(dict_file, chars=["1", "1", "2"])
      with self.assertRaises(AssertionError):
          dict_gen = Dictionary(dict_file=dict_file)
  
      tmp_dir.cleanup()
  
file_path: mmocr/tests/test_models/test_textrecog/test_dictionary/test_dictionary.py
imports: import os.path
  import tempfile
  from unittest import TestCase
  from mmocr.models.common import Dictionary
  from mmocr.testing import create_dummy_dict_file
label_desc: Use image node_id 1 for calling the TestDictionary obj's underlying member method code with example usage: obj.test_init() without return types