Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2ad68e69
Kaydet (Commit)
2ad68e69
authored
Eyl 06, 2004
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Ported test__locale to unittest.
üst
9fd5e9a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
26 deletions
+95
-26
test__locale.py
Lib/test/test__locale.py
+34
-26
NEWS
Misc/NEWS
+61
-0
No files found.
Lib/test/test__locale.py
Dosyayı görüntüle @
2ad68e69
from
test.test_support
import
verbose
,
TestSkipped
from
test.test_support
import
verbose
,
TestSkipped
,
run_unittest
from
_locale
import
setlocale
,
LC_NUMERIC
,
RADIXCHAR
,
THOUSEP
,
nl_langinfo
from
_locale
import
(
setlocale
,
LC_NUMERIC
,
RADIXCHAR
,
THOUSEP
,
nl_langinfo
,
from
_locale
import
localeconv
,
Error
localeconv
,
Error
)
from
locale
import
getlocale
import
unittest
candidate_locales
=
[
'es_UY'
,
'fr_FR'
,
'fi_FI'
,
'es_CO'
,
'pt_PT'
,
'it_IT'
,
candidate_locales
=
[
'es_UY'
,
'fr_FR'
,
'fi_FI'
,
'es_CO'
,
'pt_PT'
,
'it_IT'
,
'et_EE'
,
'es_PY'
,
'no_NO'
,
'nl_NL'
,
'lv_LV'
,
'el_GR'
,
'be_BY'
,
'fr_BE'
,
'et_EE'
,
'es_PY'
,
'no_NO'
,
'nl_NL'
,
'lv_LV'
,
'el_GR'
,
'be_BY'
,
'fr_BE'
,
...
@@ -13,26 +15,32 @@ candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT',
...
@@ -13,26 +15,32 @@ candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT',
'eu_ES'
,
'vi_VN'
,
'af_ZA'
,
'nb_NO'
,
'en_DK'
,
'tg_TJ'
,
'eu_ES'
,
'vi_VN'
,
'af_ZA'
,
'nb_NO'
,
'en_DK'
,
'tg_TJ'
,
'es_ES.ISO8859-1'
,
'fr_FR.ISO8859-15'
,
'ru_RU.KOI8-R'
,
'ko_KR.eucKR'
]
'es_ES.ISO8859-1'
,
'fr_FR.ISO8859-15'
,
'ru_RU.KOI8-R'
,
'ko_KR.eucKR'
]
oldlocale
=
setlocale
(
LC_NUMERIC
)
class
_LocaleTests
(
unittest
.
TestCase
):
try
:
saw_locale
=
0
def
setUp
(
self
):
for
loc
in
candidate_locales
:
self
.
oldlocale
=
setlocale
(
LC_NUMERIC
)
try
:
setlocale
(
LC_NUMERIC
,
loc
)
def
tearDown
(
self
):
except
Error
:
setlocale
(
LC_NUMERIC
,
self
.
oldlocale
)
continue
if
verbose
:
def
test_lc_numeric
(
self
):
print
"locale
%
r"
%
loc
for
loc
in
candidate_locales
:
saw_locale
=
1
try
:
nl_radixchar
=
nl_langinfo
(
RADIXCHAR
)
setlocale
(
LC_NUMERIC
,
loc
)
li_radixchar
=
localeconv
()[
'decimal_point'
]
except
Error
:
if
nl_radixchar
!=
li_radixchar
:
continue
print
"
%
r !=
%
r"
%
(
nl_radixchar
,
li_radixchar
)
for
li
,
lc
in
((
RADIXCHAR
,
"decimal_point"
),
nl_radixchar
=
nl_langinfo
(
THOUSEP
)
(
THOUSEP
,
"thousands_sep"
)):
li_radixchar
=
localeconv
()[
'thousands_sep'
]
nl_radixchar
=
nl_langinfo
(
li
)
if
nl_radixchar
!=
li_radixchar
:
li_radixchar
=
localeconv
()[
lc
]
print
"
%
r !=
%
r"
%
(
nl_radixchar
,
li_radixchar
)
self
.
assertEquals
(
nl_radixchar
,
li_radixchar
,
if
not
saw_locale
:
"
%
r !=
%
r (
%
s); "
raise
ImportError
,
"None of the listed locales found"
"supposed to be
%
s, set to
%
s"
%
finally
:
(
nl_radixchar
,
li_radixchar
,
lc
,
setlocale
(
LC_NUMERIC
,
oldlocale
)
loc
,
getlocale
(
LC_NUMERIC
)[
0
]))
def
test_main
():
run_unittest
(
_LocaleTests
)
if
__name__
==
'__main__'
:
test_main
()
Misc/NEWS
Dosyayı görüntüle @
2ad68e69
...
@@ -4,6 +4,67 @@ Python News
...
@@ -4,6 +4,67 @@ Python News
(
editors
:
check
NEWS
.
help
for
information
about
editing
NEWS
using
ReST
.)
(
editors
:
check
NEWS
.
help
for
information
about
editing
NEWS
using
ReST
.)
What
's New in Python 2.4 beta 1?
================================
*Release date: XXXX-XX-XX*
Core and builtins
-----------------
...
Extension modules
-----------------
...
Library
-------
...
Build
-----
...
C API
-----
...
Documentation
-------------
...
Tests
-----
- test__locale ported to unittest
Windows
-------
...
Mac
---
...
New platforms
-------------
...
Tools/Demos
-----------
...
What'
s
New
in
Python
2.4
alpha
3
?
What'
s
New
in
Python
2.4
alpha
3
?
=================================
=================================
...
...
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