Changes in tests/python/template.py [974dddc:038852a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/python/template.py
r974dddc r038852a 1 1 2 import unittest 2 3 … … 4 5 5 6 def assertCloseEnough(self, first, second, places=5, msg=None): 6 """Fail if the two objects are unequal as determined by their7 *relative* difference rounded to the given number of decimal places8 (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))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 TracChangeset
for help on using the changeset viewer.