code: def test_get_gold_spans_correctly_extracts_spans(self):
      ptb_reader = PennTreeBankConstituencySpanDatasetReader()
      tree = Tree.fromstring(
          "(S (NP (D the) (N dog)) (VP (V chased) (NP (D the) (N cat))))"
      )
  
      span_dict = {}
      ptb_reader._get_gold_spans(tree, 0, span_dict)
      spans = list(
          span_dict.items()
      )  # pylint: disable=protected-access
      assert spans == [
          ((0, 1), "NP"),
          ((3, 4), "NP"),
          ((2, 4), "VP"),
          ((0, 4), "S"),
      ]
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/data/dataset_readers/penn_tree_bank_reader_test.py
imports: from __future__ import division
  from __future__ import absolute_import
  from nltk.tree import Tree
  from allennlp.data.dataset_readers import PennTreeBankConstituencySpanDatasetReader
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data.dataset_readers.dataset_utils.span_utils import enumerate_spans
label_desc: Use image node_id 4 for calling the TestPennTreeBankConstituencySpanReader obj's underlying member method code with example usage: obj.test_get_gold_spans_correctly_extracts_spans() without return types