feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 4ce62cd was
038852a,
checked in by Paul Brossier <piem@piem.org>, 17 years ago
|
updated fft.py tests, added template for assertCloseEnough
|
-
Property mode set to
100644
|
File size:
750 bytes
|
Line | |
---|
1 | |
---|
2 | import unittest |
---|
3 | |
---|
4 | class aubio_unit_template(unittest.TestCase): |
---|
5 | |
---|
6 | def assertCloseEnough(self, first, second, places=5, msg=None): |
---|
7 | """Fail if the two objects are unequal as determined by their |
---|
8 | *relative* difference rounded to the given number of decimal places |
---|
9 | (default 7) and comparing to zero. |
---|
10 | """ |
---|
11 | if round(first, places) == 0: |
---|
12 | if round(second-first, places) != 0: |
---|
13 | raise self.failureException, \ |
---|
14 | (msg or '%r != %r within %r places' % (first, second, places)) |
---|
15 | else: |
---|
16 | if round((second-first)/first, places) != 0: |
---|
17 | raise self.failureException, \ |
---|
18 | (msg or '%r != %r within %r places' % (first, second, places)) |
---|
Note: See
TracBrowser
for help on using the repository browser.