code: def test_entities_replace(self):
      # test wrong data
      self.assertRaises(
          AssertionError, ner_sample.entities_replace, [], ["aaa"]
      )
      self.assertRaises(
          AssertionError,
          ner_sample.entities_replace,
          [{"start": 2, "end": 2, "entity": "bbb", "tag": "MISC"}],
          [],
      )
      self.assertRaises(
          AssertionError,
          ner_sample.entities_replace,
          {"start": 2, "end": 2, "entity": "bbb", "tag": "MISC"},
          ["aaa"],
      )
      self.assertRaises(
          AssertionError,
          ner_sample.entities_replace,
          [{"start": 2, "end": 2, "entity": "bbb", "tag": "MISC"}],
          "aaa",
      )
  
      # test entities_replace
      new = ner_sample.entities_replace(
          [
              {"start": 0, "end": 0, "entity": "aaa", "tag": "PRE"},
              {"start": 2, "end": 2, "entity": "bbb", "tag": "MISC"},
          ],
          ["aaa", "bbb"],
      )
      self.assertEqual(
          [
              "aaa",
              "rejects",
              "bbb",
              "call",
              "to",
              "boycott",
              "British",
              "lamb",
              ".",
          ],
          new.dump()["x"],
      )
      self.assertEqual(
          ["B-PRE", "O", "B-MISC", "O", "O", "O", "B-MISC", "O", "O"],
          new.dump()["y"],
      )
      # TODO wait repair bug
      print(new.text.mask)
  
file_path: textflint/test/input/component/sample/test_ner_sample.py
imports: import unittest
  from textflint.input.component.sample.ner_sample import *
label_desc: Use image node_id 7 for calling the TestNERSample obj's underlying member method code with example usage: obj.test_entities_replace() without return types