source: tests/python/template.py @ 1294862

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

move tests/python/demo to tests/, add localaubio.py module helpers

  • Property mode set to 100644
File size: 693 bytes
Line 
1import unittest
2
3class aubio_unit_template(unittest.TestCase):
4 
5  def assertCloseEnough(self, first, second, places=5, msg=None):
6    """Fail if the two objects are unequal as determined by their
7       *relative* difference rounded to the given number of decimal places
8       (default 7) and comparing to zero.
9    """
10    if round(first, places) == 0:
11      if round(second-first, places) != 0:
12        raise self.failureException, \
13              (msg or '%r != %r within %r places' % (first, second, places))
14    else:
15      if round((second-first)/first, places) != 0:
16        raise self.failureException, \
17              (msg or '%r != %r within %r places' % (first, second, places))
Note: See TracBrowser for help on using the repository browser.