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

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

simplified examples template

  • Property mode set to 100644
File size: 1.4 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    assert output_lines[0] == "Unable to open input file /dev/null."
33    #assert output_lines[1] == "Supported file format but file is malformed."
34    assert output_lines[2] == "Could not open input file /dev/null."
35
36mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"]
37for name in mode_names:
38  exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\
39    options = \" -p " + name + " \"")
40
41if __name__ == '__main__': unittest.main()
Note: See TracBrowser for help on using the repository browser.