code: def testConstantInput(self):
      # constant detection function should return first position:
      n = 10
      detection = ones(100).reshape(n, n)
      weights = ones(n)
      size = 2048
      sr = 44100.0
      while size > 32:
          hopsize = size / 2
          # TODO there will be an onset detected on the first frame for a
          # non-zero constant signal, which is probably ok
          frameTime = (size - hopsize) / sr
          frameRate = 1.0 / frameTime
          if size == 1024 and hopsize == 512:
              onset = Onsets(frameRate=frameRate)(detection, weights)
              self.assertAlmostEqualVector(onset, array([frameTime]))
          else:
              # Onsets does not support other framerates than
              # (1024-512)/44100
              # Onsets() outputs a warning instead of exception from now on
              # self.assertConfigureFails(Onsets(), { 'frameRate': frameRate })
              pass
          size //= 2
  
file_path: essentia/test/src/unittests/rhythm/test_onsets.py
imports: from essentia_test import *
label_desc: Use image node_id 2 for calling the TestOnsets obj's underlying member method code with example usage: obj.testConstantInput() without return types