code: def test_open_close(unary_trees, gold_sequences):
      close_transition = CloseConstituent()
  
      expected_repairs = [
          [
              (
                  7,
                  "(ROOT (S (S (NP (DT A) (NN record) (NN date)) (VBZ has)) (RB n't) (VP (VBN been) (VP (VBN set))) (. .)))",
              ),
              (
                  10,
                  "(ROOT (S (NP (DT A) (NN record) (NN date)) (VP (VP (VBZ has) (RB n't) (VBN been)) (VP (VBN set))) (. .)))",
              ),
          ],
          # missed the WHNP.  The surrounding SBAR cannot be created, either
          [
              (
                  7,
                  "(ROOT (S (NP (NP (NP (RB Not) (PDT all) (DT those)) (WP who)) (S (VP (VBD wrote)))) (VP (VBP oppose) (NP (DT the) (NNS changes))) (. .)))",
              ),
              # missed the SBAR
              (
                  9,
                  "(ROOT (S (NP (NP (NP (RB Not) (PDT all) (DT those)) (WHNP (WP who))) (S (VP (VBD wrote)))) (VP (VBP oppose) (NP (DT the) (NNS changes))) (. .)))",
              ),
              # missed the VP around "oppose the changes"
              (
                  19,
                  "(ROOT (S (S (NP (NP (RB Not) (PDT all) (DT those)) (SBAR (WHNP (WP who)) (S (VP (VBD wrote))))) (VBP oppose)) (NP (DT the) (NNS changes)) (. .)))",
              ),
              # missed the NP in "the changes", looks pretty bad tbh
              (
                  21,
                  "(ROOT (S (NP (NP (RB Not) (PDT all) (DT those)) (SBAR (WHNP (WP who)) (S (VP (VBD wrote))))) (VP (VP (VBP oppose) (DT the)) (NNS changes)) (. .)))",
              ),
          ],
          [
              (
                  14,
                  "(ROOT (S (S (PRN (S (VP (VB See)))) (, ,) (NP (DT the) (JJ other) (NN rule))) (PP (IN of) (NP (NN thumb))) (PP (IN about) (NP (NN ballooning)))))",
              ),
              (
                  16,
                  "(ROOT (S (PRN (S (VP (VB See)))) (, ,) (NP (NP (NP (DT the) (JJ other) (NN rule)) (IN of)) (NP (NN thumb)) (PP (IN about) (NP (NN ballooning))))))",
              ),
              (
                  22,
                  "(ROOT (S (PRN (S (VP (VB See)))) (, ,) (NP (NP (NP (DT the) (JJ other) (NN rule)) (PP (IN of) (NP (NN thumb))) (IN about)) (NP (NN ballooning)))))",
              ),
          ],
          [
              (
                  5,
                  "(ROOT (S (S (NP (NNS optimists)) (VBP expect)) (S (NP (NNP Hong) (NNP Kong)) (VP (TO to) (VP (VB hum) (ADVP (RB along)) (SBAR (RB as) (S (VP (ADVP (IN before))))))))))",
              ),
              (
                  10,
                  "(ROOT (S (NP (NNS optimists)) (VP (VP (VBP expect) (NP (NNP Hong) (NNP Kong))) (VP (TO to) (VP (VB hum) (ADVP (RB along)) (SBAR (RB as) (S (VP (ADVP (IN before))))))))))",
              ),
              (
                  12,
                  "(ROOT (S (NP (NNS optimists)) (VP (VBP expect) (S (S (NP (NNP Hong) (NNP Kong)) (TO to)) (VP (VB hum) (ADVP (RB along)) (SBAR (RB as) (S (VP (ADVP (IN before))))))))))",
              ),
              (
                  14,
                  "(ROOT (S (NP (NNS optimists)) (VP (VBP expect) (S (NP (NNP Hong) (NNP Kong)) (VP (VP (TO to) (VB hum)) (ADVP (RB along)) (SBAR (RB as) (S (VP (ADVP (IN before))))))))))",
              ),
              (
                  19,
                  "(ROOT (S (NP (NNS optimists)) (VP (VBP expect) (S (NP (NNP Hong) (NNP Kong)) (VP (TO to) (VP (VP (VB hum) (ADVP (RB along)) (RB as)) (S (VP (ADVP (IN before))))))))))",
              ),
          ],
      ]
  
      for tree, sequence, expected in zip(
          unary_trees, gold_sequences, expected_repairs
      ):
          repairs = get_repairs(
              sequence, close_transition, fix_open_close
          )
  
          assert len(repairs) == len(expected)
          for repair, (idx, expected_tree) in zip(repairs, expected):
              assert repair[0] == idx
              result_tree = reconstruct_tree(tree, repair[1])
              assert str(result_tree) == expected_tree
  
imports: import itertools
  import pytest
  from stanza.models.constituency import parse_transitions
  from stanza.models.constituency import tree_reader
  from stanza.models.constituency.base_model import SimpleModel
  from stanza.models.constituency.in_order_oracle import *
  from stanza.models.constituency.parse_transitions import CloseConstituent, OpenConstituent, Shift, TransitionScheme
  from stanza.models.constituency.transition_sequence import build_treebank
  from stanza.tests import *
  from stanza.tests.constituency.test_transition_sequence import reconstruct_tree
label_desc: Use image node_id 10 for calling a global function with example usage: test_open_close(unary_trees, gold_sequences) without return types