code: def test_unary(model=None):
      if model is None:
          model = SimpleModel()
      state = build_initial_state(model)[0]
  
      shift = parse_transitions.Shift()
      state = shift.apply(state, model)
  
      # this is technically the wrong parse but we're being lazy
      unary = parse_transitions.CompoundUnary("S", "VP")
      assert unary.is_legal(state, model)
      state = unary.apply(state, model)
      assert not unary.is_legal(state, model)
  
      tree = model.get_top_constituent(state.constituents)
      assert tree.label == "S"
      assert len(tree.children) == 1
      tree = tree.children[0]
      assert tree.label == "VP"
      assert len(tree.children) == 1
      tree = tree.children[0]
      assert tree.label == "VB"
      assert tree.is_preterminal()
  
imports: import pytest
  from stanza.models.constituency import parse_transitions
  from stanza.models.constituency.base_model import SimpleModel, UNARY_LIMIT
  from stanza.models.constituency.parse_transitions import TransitionScheme, Shift, CloseConstituent, OpenConstituent
  from stanza.tests import *
label_desc: Use image node_id 5 for calling a global function with example usage: test_unary(model) without return types