code: def test_replace_tags():
      """
      Test the underlying replace_tags method
  
      Also tests that the method throws exceptions when it is supposed to
      """
      text = "((S (VP (X Find)) (NP (X Mox) (X Opal))))"
      expected = "((S (VP (A Find)) (NP (B Mox) (C Opal))))"
  
      trees = tree_reader.read_trees(text)
  
      new_tags = ["A", "B", "C"]
      new_tree = utils.replace_tags(trees[0], new_tags)
  
      assert new_tree == tree_reader.read_trees(expected)[0]
  
      with pytest.raises(ValueError):
          new_tags = ["A", "B"]
          new_tree = utils.replace_tags(trees[0], new_tags)
  
      with pytest.raises(ValueError):
          new_tags = ["A", "B", "C", "D"]
          new_tree = utils.replace_tags(trees[0], new_tags)
  
file_path: stanza/stanza/tests/constituency/test_utils.py
imports: import pytest
  from stanza import Pipeline
  from stanza.models.constituency import tree_reader
  from stanza.models.constituency import utils
  from stanza.tests import *
label_desc: Use image node_id 4 for calling a global function with example usage: test_replace_tags() without return types