feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 554a9cb was
8987df1,
checked in by Paul Brossier <piem@piem.org>, 17 years ago
|
tests template.py: re-ident
|
-
Property mode set to
100644
|
File size:
694 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.