code: def test_R(doc):
      state = StateClass(doc)
      assert state.R(0, 1) == -1
      state.add_arc(0, 1, 0)
      assert state.arcs == [{"head": 0, "child": 1, "label": 0}]
      assert state.R(0, 1) == 1
      state.add_arc(0, 2, 0)
      assert state.R(0, 1) == 2
      assert state.n_R(0) == 2
  
file_path: spacy/spacy/tests/parser/test_state.py
imports: import pytest
  from spacy.pipeline._parser_internals.stateclass import StateClass
  from spacy.tokens.doc import Doc
  from spacy.vocab import Vocab
label_desc: Use image node_id 8 for calling a global function with example usage: test_R(doc) without return types