code: def testLastBeatTooShort(self):
      beatDuration = 0.5  # in seconds
  
      # 1 second silence, beat for beatDuration (s), 1 second silence, then last beat lasts half beatDuration
      signal = (
          [0] * 44100
          + [1] * int(44100 * beatDuration)
          + [0] * 44100
          + [1] * int(44100 * beatDuration / 2)
      )
  
      beatPositions = [
          1 + beatDuration / 2.0,
          2.05 + beatDuration / 4.0,
      ]  # each in seconds
  
      gen = VectorInput(signal)
      beatsLoudness = BeatsLoudness(
          beats=beatPositions,
          frequencyBands=[20, 150],
          beatDuration=beatDuration,
          beatWindowDuration=0.5,
      )
      p = Pool()
  
      gen.data >> beatsLoudness.signal
      beatsLoudness.loudness >> (p, "beats.loudness")
      beatsLoudness.loudnessBandRatio >> (p, "beats.loudnessBandRatio")
  
      run(gen)
  
      # the last beat should have been thrown away since it didn't last for a
      # whole beat duration
      self.assertAlmostEqualVector(p["beats.loudness"], [5.22167], 1e-5)
      self.assertAlmostEqualVector(
          p["beats.loudnessBandRatio"], [2.07204e-13], 2e-2
      )
  
file_path: essentia/test/src/unittests/rhythm/test_beatsloudness_streaming.py
imports: from essentia_test import *
  from essentia.streaming import BeatsLoudness, MonoLoader, RhythmExtractor
label_desc: Use image node_id 5 for calling the TestBeatsLoudness obj's underlying member method code with example usage: obj.testLastBeatTooShort() without return types