code: def test_shift(model=None):
      if model is None:
          model = SimpleModel()
      state = build_initial_state(model)[0]
  
      open_transition = parse_transitions.OpenConstituent("ROOT")
      state = open_transition.apply(state, model)
      open_transition = parse_transitions.OpenConstituent("S")
      state = open_transition.apply(state, model)
      shift = parse_transitions.Shift()
      assert shift.is_legal(state, model)
      assert len(state.word_queue) == 5
      assert state.word_position == 0
  
      state = shift.apply(state, model)
      assert len(state.word_queue) == 5
      # 4 because of the dummy created by the opens
      assert len(state.constituents) == 4
      assert len(state.transitions) == 4
      assert shift.is_legal(state, model)
      assert state.word_position == 1
      assert not state.empty_word_queue()
  
      state = shift.apply(state, model)
      assert len(state.word_queue) == 5
      assert len(state.constituents) == 5
      assert len(state.transitions) == 5
      assert shift.is_legal(state, model)
      assert state.word_position == 2
      assert not state.empty_word_queue()
  
      state = shift.apply(state, model)
      assert len(state.word_queue) == 5
      assert len(state.constituents) == 6
      assert len(state.transitions) == 6
      assert not shift.is_legal(state, model)
      assert state.word_position == 3
      assert state.empty_word_queue()
  
      constituents = state.constituents
      assert (
          model.get_top_constituent(constituents).children[0].label
          == "Opal"
      )
      constituents = constituents.pop()
      assert (
          model.get_top_constituent(constituents).children[0].label
          == "Mox"
      )
      constituents = constituents.pop()
      assert (
          model.get_top_constituent(constituents).children[0].label
          == "Unban"
      )
  
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 3 for calling a global function with example usage: test_shift(model) without return types