From f1771f909f6e5a5e0bcf7cf238aa51a0cbd0996a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 1 Dec 2007 15:51:27 +0100 Subject: [PATCH] aubioonset.py tests: add specflux, use assertEqual --- tests/python/examples/aubioonset.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/python/examples/aubioonset.py b/tests/python/examples/aubioonset.py index 6d14141b..ebea1990 100644 --- a/tests/python/examples/aubioonset.py +++ b/tests/python/examples/aubioonset.py @@ -1,6 +1,6 @@ from template import * -class aubioonset_test_case(program_test_case): +class aubioonset_unit(program_test_case): import os.path filename = os.path.join('..','..','sounds','woodblock.aiff') @@ -23,14 +23,17 @@ class aubioonset_test_case(program_test_case): self.command += " -s -100 " self.getOutput() # only one onset in woodblock.aiff - assert len(str(self.output)) != 0, "no output produced with command:\n" \ - + self.command - assert len(self.output.split('\n')) == 1 + self.assertNotEqual(0, len(str(self.output)), \ + "no output produced with command:\n" + self.command) + self.assertEqual(1, len(self.output.split('\n')) ) # onset should be at 0.00000 - assert float(self.output.strip()) == 0. + self.assertEqual(0, float(self.output.strip())) + +list_of_onset_modes = ["energy", "specdiff", "hfc", "complex", "phase", \ + "kl", "mkl", "specflux"] -for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]: - exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\ +for name in list_of_onset_modes: + exec("class aubioonset_"+name+"_unit(aubioonset_unit):\n\ options = \" -O "+name+" \"") if __name__ == '__main__': unittest.main() -- 2.26.2