code: def __test_pitch(jam_orig, jam_new, n_semitones, tuning):
      if -0.5 < tuning + n_semitones <= 0.5:
          q_tones = 0.0
      else:
          q_tones = n_semitones
  
      # Test each annotation
      for ann_orig, ann_new in zip(
          jam_orig.annotations, jam_new.annotations
      ):
          assert len(ann_orig) == len(ann_new)
  
          if ann_orig.namespace in ["chord", "chord_harte", "key_mode"]:
              __test_note(ann_orig, ann_new, q_tones)
          elif ann_orig.namespace in ["pitch_class", "chord_roman"]:
              __test_tonic(ann_orig, ann_new, q_tones)
          elif ann_orig.namespace == "pitch_contour":
              __test_contour(ann_orig, ann_new, n_semitones)
          elif ann_orig.namespace == "pitch_hz":
              __test_hz(ann_orig, ann_new, n_semitones)
          elif ann_orig.namespace == "pitch_midi":
              __test_midi(ann_orig, ann_new, n_semitones)
  
imports: from copy import deepcopy
  import re
  import six
  import numpy
  import soundfile
  import jams
  import librosa
  import muda
  import pytest
  import scipy
  from contextlib import contextmanager
label_desc: Use image node_id 21 for calling a global function with example usage: __test_pitch(jam_orig, jam_new, n_semitones, tuning) without return types