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
ec75312e
Commit
ec75312e
authored
May 04, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
see if we can get this to work on windows
parent
3c33e087
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
Lib/test/test__locale.py
Lib/test/test__locale.py
+16
-8
No files found.
Lib/test/test__locale.py
View file @
ec75312e
from
test.support
import
verbose
,
run_unittest
from
_locale
import
(
setlocale
,
LC_ALL
,
LC_CTYPE
,
LC_NUMERIC
,
RADIXCHAR
,
THOUSEP
,
nl_langinfo
,
localeconv
,
Error
)
import
_locale
from
_locale
import
(
setlocale
,
LC_ALL
,
LC_CTYPE
,
LC_NUMERIC
,
nl_langinfo
,
localeconv
,
Error
)
import
unittest
from
platform
import
uname
...
...
@@ -25,6 +26,10 @@ candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT',
# value is not known, use '' .
known_numerics
=
{
'fr_FR'
:
(
','
,
''
),
'en_US'
:(
'.'
,
','
)}
def
needs_radix_and_thousands
(
func
):
return
unittest
.
skipUnless
(
hasattr
(
_locale
,
"RADIXCHAR"
),
"needs RADIXCHAR and THOUSEP"
)(
func
)
class
_LocaleTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -53,6 +58,7 @@ class _LocaleTests(unittest.TestCase):
calc_type
,
data_type
,
set_locale
,
used_locale
))
@
needs_radix_and_thousands
def
test_lc_numeric_nl_langinfo
(
self
):
# Test nl_langinfo against known values
for
loc
in
candidate_locales
:
...
...
@@ -61,10 +67,11 @@ class _LocaleTests(unittest.TestCase):
setlocale
(
LC_CTYPE
,
loc
)
except
Error
:
continue
for
li
,
lc
in
((
RADIXCHAR
,
"decimal_point"
),
(
THOUSEP
,
"thousands_sep"
)):
for
li
,
lc
in
((
_locale
.
RADIXCHAR
,
"decimal_point"
),
(
_locale
.
THOUSEP
,
"thousands_sep"
)):
self
.
numeric_tester
(
'nl_langinfo'
,
nl_langinfo
(
li
),
lc
,
loc
)
@
needs_radix_and_thousands
def
test_lc_numeric_localeconv
(
self
):
# Test localeconv against known values
for
loc
in
candidate_locales
:
...
...
@@ -73,10 +80,11 @@ class _LocaleTests(unittest.TestCase):
setlocale
(
LC_CTYPE
,
loc
)
except
Error
:
continue
for
li
,
lc
in
((
RADIXCHAR
,
"decimal_point"
),
(
THOUSEP
,
"thousands_sep"
)):
for
li
,
lc
in
((
_locale
.
RADIXCHAR
,
"decimal_point"
),
(
_locale
.
THOUSEP
,
"thousands_sep"
)):
self
.
numeric_tester
(
'localeconv'
,
localeconv
()[
lc
],
lc
,
loc
)
@
needs_radix_and_thousands
def
test_lc_numeric_basic
(
self
):
# Test nl_langinfo against localeconv
for
loc
in
candidate_locales
:
...
...
@@ -85,8 +93,8 @@ class _LocaleTests(unittest.TestCase):
setlocale
(
LC_CTYPE
,
loc
)
except
Error
:
continue
for
li
,
lc
in
((
RADIXCHAR
,
"decimal_point"
),
(
THOUSEP
,
"thousands_sep"
)):
for
li
,
lc
in
((
_locale
.
RADIXCHAR
,
"decimal_point"
),
(
_locale
.
THOUSEP
,
"thousands_sep"
)):
nl_radixchar
=
nl_langinfo
(
li
)
li_radixchar
=
localeconv
()[
lc
]
try
:
...
...
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