Changeset 100f950 for tests/python/examples
- Timestamp:
- Nov 1, 2007, 4:40:15 PM (17 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 1da7e08, d6f515d
- Parents:
- cea30b8
- Location:
- tests/python/examples
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/python/examples/aubionotes.py
rcea30b8 r100f950 5 5 import os.path 6 6 filename = os.path.join('..','..','sounds','woodblock.aiff') 7 progname = os.path.join('..','..','examples','aubio onset')7 progname = os.path.join('..','..','examples','aubionotes') 8 8 9 9 def test_aubionotes(self): … … 11 11 self.getOutput() 12 12 # FIXME: useless check 13 assert len(self.output) >= 0 13 self.assertEqual(len(self.output.split('\n')), 1) 14 self.assertEqual(float(self.output.strip()), 0.017415) 14 15 15 16 def test_aubionotes_verbose(self): … … 24 25 self.filename = "/dev/null" 25 26 # exit status should not be 0 26 self.getOutput(expected_status = -1) 27 assert self.status != 0 27 self.getOutput(expected_status = 256) 28 28 # and there should be an error message 29 29 assert len(self.output) > 0 … … 34 34 assert output_lines[2] == "Could not open input file /dev/null." 35 35 36 mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"] 37 for name in mode_names: 38 exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\ 39 options = \" -p " + name + " \"") 40 36 41 if __name__ == '__main__': unittest.main() -
tests/python/examples/aubioonset.py
rcea30b8 r100f950 10 10 """ test aubioonset with default parameters """ 11 11 self.getOutput() 12 assert len(self.output) != 0, self.output13 12 assert len(str(self.output)) != 0, "no output produced with command:\n" \ 14 13 + self.command … … 25 24 self.getOutput() 26 25 # only one onset in woodblock.aiff 27 assert len(self.output.split('\n')) == 128 26 assert len(str(self.output)) != 0, "no output produced with command:\n" \ 29 27 + self.command 28 assert len(self.output.split('\n')) == 1 30 29 # onset should be at 0.00000 31 30 assert float(self.output.strip()) == 0. 32 31 33 class aubioonset_test_case_energy(aubioonset_test_case):34 def setUp(self, options = " -O energy "):35 aubioonset_test_case.setUp(self, options = options)32 for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]: 33 exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\ 34 options = \" -O "+name+" \"") 36 35 37 class aubioonset_test_case_specdiff(aubioonset_test_case): 38 def setUp(self, options = " -O specdiff "): 39 aubioonset_test_case.setUp(self, options = options) 40 41 class aubioonset_test_case_hfc(aubioonset_test_case): 42 def setUp(self, options = " -O hfc "): 43 aubioonset_test_case.setUp(self, options = options) 44 45 class aubioonset_test_case_complex(aubioonset_test_case): 46 def setUp(self, options = " -O complex "): 47 aubioonset_test_case.setUp(self, options = options) 48 49 class aubioonset_test_case_phase(aubioonset_test_case): 50 def setUp(self, options = " -O phase"): 51 aubioonset_test_case.setUp(self, options = options) 52 53 class aubioonset_test_case_kl(aubioonset_test_case): 54 def setUp(self, options = " -O kl "): 55 aubioonset_test_case.setUp(self, options = options) 56 57 class aubioonset_test_case_mkl(aubioonset_test_case): 58 def setUp(self, options = " -O mkl "): 59 aubioonset_test_case.setUp(self, options = options) 60 61 if __name__ == '__main__': 62 63 unittest.main() 36 if __name__ == '__main__': unittest.main() -
tests/python/examples/template.py
rcea30b8 r100f950 7 7 progname = "UNDEFINED" 8 8 command = "" 9 10 def setUp(self, options = ""): 11 self.options = options 9 options = "" 12 10 13 11 def getOutput(self, expected_status = 0):
Note: See TracChangeset
for help on using the changeset viewer.