diff test/test_process.py @ 100:72be91c3cb3d

Add & test process_frames_multiple_outputs
author Chris Cannam
date Tue, 10 Feb 2015 10:56:44 +0000
parents f0c18ba7b54e
children 0c5a4dc04ed9
line wrap: on
line diff
--- a/test/test_process.py	Tue Feb 03 16:24:37 2015 +0000
+++ b/test/test_process.py	Tue Feb 10 10:56:44 2015 +0000
@@ -103,6 +103,21 @@
         actual = results[i]["input-summary"]["values"][0]
         assert actual == expected
 
+def test_process_multi_summary_frames():
+    buf = input_data(blocksize * 10)
+    ff = fr.frames_from_array(buf, blocksize, blocksize)
+    results = list(vamp.process_frames_multiple_outputs(ff, rate, blocksize, plugin_key, [ "input-summary" ], {}))
+    assert len(results) == 10
+    for i in range(len(results)):
+        #
+        # each feature has a single value, equal to the number of non-zero elts
+        # in the input block (which is all of them, i.e. the blocksize) plus
+        # the first elt (which is i * blockSize + 1)
+        #
+        expected = blocksize + i * blocksize + 1
+        actual = results[i]["input-summary"]["values"][0]
+        assert actual == expected
+
 def test_process_freq_summary():
     buf = input_data(blocksize * 10)
     results = list(vamp.process(buf, rate, plugin_key_freq, "input-summary", {}))