Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
20c049df
Commit
20c049df
authored
Oct 14, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21855: Fixed the decimal module in unicode disabled build.
parent
9c2ce254
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
Lib/decimal.py
Lib/decimal.py
+4
-1
Lib/test/test_decimal.py
Lib/test/test_decimal.py
+5
-4
No files found.
Lib/decimal.py
View file @
20c049df
...
...
@@ -6035,7 +6035,10 @@ def _parse_format_specifier(format_spec, _localeconv=None):
format_dict
[
'decimal_point'
]
=
'.'
# record whether return type should be str or unicode
format_dict
[
'unicode'
]
=
isinstance
(
format_spec
,
unicode
)
try
:
format_dict
[
'unicode'
]
=
isinstance
(
format_spec
,
unicode
)
except
NameError
:
format_dict
[
'unicode'
]
=
False
return
format_dict
...
...
Lib/test/test_decimal.py
View file @
20c049df
...
...
@@ -31,7 +31,7 @@ import pickle, copy
import
unittest
from
decimal
import
*
import
numbers
from
test.test_support
import
(
run_unittest
,
run_doctest
,
from
test.test_support
import
(
run_unittest
,
run_doctest
,
requires_unicode
,
u
,
is_resource_enabled
,
check_py3k_warnings
)
import
random
try
:
...
...
@@ -595,11 +595,12 @@ class DecimalExplicitConstructionTest(unittest.TestCase):
d
=
nc
.
create_decimal
(
prevdec
)
self
.
assertEqual
(
str
(
d
),
'5.00E+8'
)
@
requires_unicode
def
test_unicode_digits
(
self
):
test_values
=
{
u
'
\
uff11
'
:
'1'
,
u
'
\
u0660
.
\
u0660
\
u0663
\
u0667
\
u0662
e-
\
u0663
'
:
'0.0000372'
,
u
'-nan
\
u0c68
\
u0c6a
\
u0c66
\
u0c66
'
:
'-NaN2400'
,
u
(
r'\uff11'
)
:
'1'
,
u
(
r'\u0660.\u0660\u0663\u0667\u0662e-\u0663'
)
:
'0.0000372'
,
u
(
r'-nan\u0c68\u0c6a\u0c66\u0c66'
)
:
'-NaN2400'
,
}
for
input
,
expected
in
test_values
.
items
():
self
.
assertEqual
(
str
(
Decimal
(
input
)),
expected
)
...
...
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