Changeset 100f950


Ignore:
Timestamp:
Nov 1, 2007, 4:40:15 PM (17 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

simplified examples template

Location:
tests/python/examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/python/examples/aubionotes.py

    rcea30b8 r100f950  
    55  import os.path
    66  filename = os.path.join('..','..','sounds','woodblock.aiff')
    7   progname = os.path.join('..','..','examples','aubioonset')
     7  progname = os.path.join('..','..','examples','aubionotes')
    88
    99  def test_aubionotes(self):
     
    1111    self.getOutput()
    1212    # 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)
    1415
    1516  def test_aubionotes_verbose(self):
     
    2425    self.filename = "/dev/null"
    2526    # exit status should not be 0
    26     self.getOutput(expected_status = -1)
    27     assert self.status != 0
     27    self.getOutput(expected_status = 256)
    2828    # and there should be an error message
    2929    assert len(self.output) > 0
     
    3434    assert output_lines[2] == "Could not open input file /dev/null."
    3535
     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
    3641if __name__ == '__main__': unittest.main()
  • tests/python/examples/aubioonset.py

    rcea30b8 r100f950  
    1010    """ test aubioonset with default parameters """
    1111    self.getOutput()
    12     assert len(self.output) != 0, self.output
    1312    assert len(str(self.output)) != 0, "no output produced with command:\n" \
    1413      + self.command
     
    2524    self.getOutput()
    2625    # only one onset in woodblock.aiff
    27     assert len(self.output.split('\n')) == 1
    2826    assert len(str(self.output)) != 0, "no output produced with command:\n" \
    2927      + self.command
     28    assert len(self.output.split('\n')) == 1
    3029    # onset should be at 0.00000
    3130    assert float(self.output.strip()) == 0.
    3231
    33 class aubioonset_test_case_energy(aubioonset_test_case):
    34   def setUp(self, options = " -O energy "):
    35     aubioonset_test_case.setUp(self, options = options)
     32for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]:
     33  exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\
     34  options = \" -O "+name+" \"")
    3635
    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()
     36if __name__ == '__main__': unittest.main()
  • tests/python/examples/template.py

    rcea30b8 r100f950  
    77  progname = "UNDEFINED"
    88  command = ""
    9 
    10   def setUp(self, options = ""):
    11     self.options = options
     9  options = ""
    1210
    1311  def getOutput(self, expected_status = 0):
Note: See TracChangeset for help on using the changeset viewer.