code: def test_projective_example():
      """
      Test reading a basic tree, along with some further manipulations from the conversion program
      """
      with tempfile.TemporaryDirectory(dir=TEST_WORKING_DIR) as tempdir:
          test_name = os.path.join(tempdir, "proj.xml")
          with open(test_name, "w", encoding="utf-8") as fout:
              fout.write(PROJ_EXAMPLE)
          sentences = convert_arboretum.read_xml_file(test_name)
          assert len(sentences) == 1
  
      tree, words = convert_arboretum.process_tree(sentences[0])
      expected_tree = "(s (fcl (prop s2_1) (v-fin s2_2) (pron-pers s2_3) (adjp (adj s2_4) (pp (prp s2_5) (np (art s2_6) (adj s2_7) (n s2_8)))) (pu s2_9)))"
      assert str(tree) == expected_tree
      assert [w.word for w in words.values()] == [
          "A",
          "B",
          "C",
          "D",
          "E",
          "F",
          "G",
          "H",
          ".",
      ]
      assert not convert_arboretum.word_sequence_missing_words(tree)
      with tsurgeon.Tsurgeon() as tsurgeon_processor:
          assert tree == convert_arboretum.check_words(
              tree, tsurgeon_processor
          )
  
      # check that the words can be replaced as expected
      replaced_tree = convert_arboretum.replace_words(tree, words)
      expected_tree = "(s (fcl (prop A) (v-fin B) (pron-pers C) (adjp (adj D) (pp (prp E) (np (art F) (adj G) (n H)))) (pu .)))"
      assert str(replaced_tree) == expected_tree
      assert (
          convert_arboretum.split_underscores(replaced_tree)
          == replaced_tree
      )
  
      # fake a word which should be split
      words["s2_1"] = words["s2_1"]._replace(word="foo_bar")
      replaced_tree = convert_arboretum.replace_words(tree, words)
      expected_tree = "(s (fcl (prop foo_bar) (v-fin B) (pron-pers C) (adjp (adj D) (pp (prp E) (np (art F) (adj G) (n H)))) (pu .)))"
      assert str(replaced_tree) == expected_tree
      expected_tree = "(s (fcl (np (prop foo) (prop bar)) (v-fin B) (pron-pers C) (adjp (adj D) (pp (prp E) (np (art F) (adj G) (n H)))) (pu .)))"
      assert (
          str(convert_arboretum.split_underscores(replaced_tree))
          == expected_tree
      )
  
file_path: stanza/stanza/tests/constituency/test_convert_arboretum.py
imports: import os
  import tempfile
  import pytest
  from stanza.server import tsurgeon
  from stanza.tests import TEST_WORKING_DIR
  from stanza.utils.datasets.constituency import convert_arboretum
label_desc: Use image node_id 1 for calling a global function with example usage: test_projective_example() without return types