diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-04-27 13:59:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-27 13:59:33 +0200 |
| commit | 2e6a589f417af48e3322955ffff6e94b6d8a24e3 (patch) | |
| tree | aa613ecc1f74a9531a03de89aa2bdc7bb32eed3b /odoo/addons/base/tests/test_float.py | |
| parent | de4a2216b953abb86094c9bfa5f45b1eaaa79d3d (diff) | |
[FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch
* thin compat module stripped down from werkzeug (to augment as needed)
issue 8530
Diffstat (limited to 'odoo/addons/base/tests/test_float.py')
| -rw-r--r-- | odoo/addons/base/tests/test_float.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/odoo/addons/base/tests/test_float.py b/odoo/addons/base/tests/test_float.py index 03e15b5877e..8c4ee380bd2 100644 --- a/odoo/addons/base/tests/test_float.py +++ b/odoo/addons/base/tests/test_float.py @@ -4,7 +4,7 @@ from math import log10 from odoo.tests.common import TransactionCase -from odoo.tools import float_compare, float_is_zero, float_repr, float_round, float_split_str +from odoo.tools import float_compare, float_is_zero, float_repr, float_round, float_split_str, pycompat class TestFloatPrecision(TransactionCase): @@ -98,14 +98,13 @@ class TestFloatPrecision(TransactionCase): precisions = [2, 2, 2, 2, 2, 2, 3, 4] # Note: max precision for double floats is 53 bits of precision or # 17 significant decimal digits - for magnitude in range(7): - for i in xrange(len(fractions)): - frac, exp, prec = fractions[i], expecteds[i], precisions[i] + for magnitude in pycompat.range(7): + for frac, exp, prec in zip(fractions, expecteds, precisions): for sign in [-1,1]: - for x in xrange(0,10000,97): - n = x * 10**magnitude + for x in pycompat.range(0, 10000, 97): + n = x * 10 ** magnitude f = sign * (n + frac) - f_exp = ('-' if f != 0 and sign == -1 else '') + str(n) + exp + f_exp = ('-' if f != 0 and sign == -1 else '') + str(n) + exp try_round(f, f_exp, digits=prec) def try_zero(amount, expected): |
