Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
ce667c12
Commit
ce667c12
authored
Jan 25, 2013
by
Julien Muchembled
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TestFloatField: fix test_render_big_numbers on Python 2.7
parent
64c1fd42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
product/ERP5Form/tests/testFields.py
product/ERP5Form/tests/testFields.py
+3
-3
product/Formulator/Widget.py
product/Formulator/Widget.py
+3
-1
No files found.
product/ERP5Form/tests/testFields.py
View file @
ce667c12
...
...
@@ -166,9 +166,9 @@ class TestFloatField(ERP5TypeTestCase):
def
test_render_big_numbers
(
self
):
self
.
field
.
values
[
'precision'
]
=
2
self
.
field
.
values
[
'editable'
]
=
0
self
.
assertEquals
(
'10000000000000
000000
.00'
,
self
.
field
.
render
(
10000000000000
000000
))
self
.
assertEquals
(
'1e+
100'
,
self
.
field
.
render
(
1e+10
0
))
self
.
assertEquals
(
'10000000000000.00'
,
self
.
field
.
render
(
10000000000000
))
self
.
assertEquals
(
'1e+
20'
,
self
.
field
.
render
(
1e+2
0
))
def
test_validate_thousand_separator_point
(
self
):
self
.
field
.
values
[
'input_style'
]
=
'-1 234.5'
...
...
product/Formulator/Widget.py
View file @
ce667c12
...
...
@@ -1812,7 +1812,9 @@ class FloatWidget(TextWidget):
float_value
=
float
(
value
)
if
percent
:
float_value
*=
100
if
precision
not
in
(
None
,
''
):
if
precision
not
in
(
None
,
''
)
and
(
# ignore precision for too big absolute numbers
abs
(
float_value
)
*
10
**
precision
<
2
**
53
):
# if we have a precision, then use it now
value
=
(
'%%0.%sf'
%
precision
)
%
float_value
else
:
...
...
Arnaud Fontaine
@arnau
mentioned in commit
16f038da
·
Aug 13, 2020
mentioned in commit
16f038da
mentioned in commit 16f038da44545fcc154f2f875beb18eb28c98579
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment