Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
ce667c12
Commit
ce667c12
authored
Jan 25, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TestFloatField: fix test_render_big_numbers on Python 2.7
parent
64c1fd42
Changes
2
Show 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
:
...
...
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