source: tests/python/examples/aubionotes.py @ ba02073

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since ba02073 was ca0a821, checked in by Paul Brossier <piem@piem.org>, 15 years ago

tests/python/examples/aubionotes.py: do not assume the error is known

  • Property mode set to 100644
File size: 1.3 KB
Line 
1from template import *
2
3class aubionotes_test_case(program_test_case):
4
5  import os.path
6  filename = os.path.join('..','..','sounds','woodblock.aiff')
7  progname = os.path.join('..','..','examples','aubionotes')
8
9  def test_aubionotes(self):
10    """ test aubionotes with default parameters """
11    self.getOutput()
12    # FIXME: useless check
13    self.assertEqual(len(self.output.split('\n')), 1)
14    self.assertEqual(float(self.output.strip()), 0.017415)
15
16  def test_aubionotes_verbose(self):
17    """ test aubionotes with -v parameter """
18    self.command += " -v "
19    self.getOutput()
20    # FIXME: loose checking: make sure at least 8 lines are printed
21    assert len(self.output) >= 8
22
23  def test_aubionotes_devnull(self):
24    """ test aubionotes on /dev/null """
25    self.filename = "/dev/null"
26    # exit status should not be 0
27    self.getOutput(expected_status = 256)
28    # and there should be an error message
29    assert len(self.output) > 0
30    # that looks like this
31    #output_lines = self.output.split('\n')
32    #for line in output_lines:
33    #  print line
34
35mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"]
36for name in mode_names:
37  exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\
38    options = \" -p " + name + " \"")
39
40if __name__ == '__main__': unittest.main()
Note: See TracBrowser for help on using the repository browser.