code: def test_shift_close(unary_trees, gold_sequences):
      """
      Test the fix for a shift -> close
  
      These errors can occur pretty much everywhere, and the fix is quite simple,
      so we only test a few cases.
      """
  
      close_transition = CloseConstituent()
  
      expected_tree = "(ROOT (S (NP (NP (DT A)) (NN record) (NN date)) (VP (VBZ has) (RB n't) (VP (VBN been) (VP (VBN set)))) (. .)))"
  
      repairs = get_repairs(
          gold_sequences[0], close_transition, fix_shift_close
      )
      assert len(repairs) == 7
      result_tree = reconstruct_tree(unary_trees[0], repairs[0][1])
      assert str(result_tree) == expected_tree
  
      repairs = get_repairs(
          gold_sequences[1], close_transition, fix_shift_close
      )
      assert len(repairs) == 8
  
      repairs = get_repairs(
          gold_sequences[2], close_transition, fix_shift_close
      )
      assert len(repairs) == 8
  
      repairs = get_repairs(
          gold_sequences[3], close_transition, fix_shift_close
      )
      assert len(repairs) == 9
      for rep in repairs:
          if rep[0] == 16:
              # This one is special because it occurs as part of a unary
              # in other words, it should go unary, shift
              # and instead we are making it close where the unary should be
              # ... the unary would create "(ADVP (RB along))"
              expected_tree = "(ROOT (S (NP (NNS optimists)) (VP (VBP expect) (S (NP (NNP Hong) (NNP Kong)) (VP (TO to) (VP (VP (VB hum) (RB along)) (SBAR (RB as) (S (VP (ADVP (IN before)))))))))))"
              result_tree = reconstruct_tree(unary_trees[3], rep[1])
              assert str(result_tree) == expected_tree
              break
      else:
          raise AssertionError(
              "Did not find an expected repair location"
          )
  
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 11 for calling a global function with example usage: test_shift_close(unary_trees, gold_sequences) without return types