From: Paul Brossier Date: Sat, 1 Dec 2007 14:51:27 +0000 (+0100) Subject: aubioonset.py tests: add specflux, use assertEqual X-Git-Tag: bzr2git~424 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f1771f909f6e5a5e0bcf7cf238aa51a0cbd0996a;p=aubio.git aubioonset.py tests: add specflux, use assertEqual --- 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()