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
ef17f12a
Kaydet (Commit)
ef17f12a
authored
Eyl 29, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test_codeccallbacks for Windows: check size of wchar_t, not sys.maxunicode
üst
182d90d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
test_codeccallbacks.py
Lib/test/test_codeccallbacks.py
+6
-4
No files found.
Lib/test/test_codeccallbacks.py
Dosyayı görüntüle @
ef17f12a
...
@@ -2,6 +2,8 @@ import test.support, unittest
...
@@ -2,6 +2,8 @@ import test.support, unittest
import
sys
,
codecs
,
html
.
entities
,
unicodedata
import
sys
,
codecs
,
html
.
entities
,
unicodedata
import
ctypes
import
ctypes
SIZEOF_WCHAR_T
=
ctypes
.
sizeof
(
ctypes
.
c_wchar
)
class
PosReturn
:
class
PosReturn
:
# this can be used for configurable callbacks
# this can be used for configurable callbacks
...
@@ -206,7 +208,7 @@ class CodecCallbackTest(unittest.TestCase):
...
@@ -206,7 +208,7 @@ class CodecCallbackTest(unittest.TestCase):
b
"
\x00\x00\x00\x00\x00
"
.
decode
,
b
"
\x00\x00\x00\x00\x00
"
.
decode
,
"unicode-internal"
,
"unicode-internal"
,
)
)
if
sys
.
maxunicode
>
0xffff
:
if
SIZEOF_WCHAR_T
==
4
:
def
handler_unicodeinternal
(
exc
):
def
handler_unicodeinternal
(
exc
):
if
not
isinstance
(
exc
,
UnicodeDecodeError
):
if
not
isinstance
(
exc
,
UnicodeDecodeError
):
raise
TypeError
(
"don't know how to handle
%
r"
%
exc
)
raise
TypeError
(
"don't know how to handle
%
r"
%
exc
)
...
@@ -356,7 +358,7 @@ class CodecCallbackTest(unittest.TestCase):
...
@@ -356,7 +358,7 @@ class CodecCallbackTest(unittest.TestCase):
[
"ascii"
,
"
\uffff
x"
,
0
,
1
,
"ouch"
],
[
"ascii"
,
"
\uffff
x"
,
0
,
1
,
"ouch"
],
"'ascii' codec can't encode character '
\\
uffff' in position 0: ouch"
"'ascii' codec can't encode character '
\\
uffff' in position 0: ouch"
)
)
if
sys
.
maxunicode
>
0xffff
:
if
SIZEOF_WCHAR_T
==
4
:
self
.
check_exceptionobjectargs
(
self
.
check_exceptionobjectargs
(
UnicodeEncodeError
,
UnicodeEncodeError
,
[
"ascii"
,
"
\U00010000
x"
,
0
,
1
,
"ouch"
],
[
"ascii"
,
"
\U00010000
x"
,
0
,
1
,
"ouch"
],
...
@@ -391,7 +393,7 @@ class CodecCallbackTest(unittest.TestCase):
...
@@ -391,7 +393,7 @@ class CodecCallbackTest(unittest.TestCase):
[
"g
\uffff
rk"
,
1
,
2
,
"ouch"
],
[
"g
\uffff
rk"
,
1
,
2
,
"ouch"
],
"can't translate character '
\\
uffff' in position 1: ouch"
"can't translate character '
\\
uffff' in position 1: ouch"
)
)
if
sys
.
maxunicode
>
0xffff
:
if
SIZEOF_WCHAR_T
==
4
:
self
.
check_exceptionobjectargs
(
self
.
check_exceptionobjectargs
(
UnicodeTranslateError
,
UnicodeTranslateError
,
[
"g
\U00010000
rk"
,
1
,
2
,
"ouch"
],
[
"g
\U00010000
rk"
,
1
,
2
,
"ouch"
],
...
@@ -682,7 +684,7 @@ class CodecCallbackTest(unittest.TestCase):
...
@@ -682,7 +684,7 @@ class CodecCallbackTest(unittest.TestCase):
# Python/codecs.c::PyCodec_XMLCharRefReplaceErrors()
# Python/codecs.c::PyCodec_XMLCharRefReplaceErrors()
# and inline implementations
# and inline implementations
v
=
(
1
,
5
,
10
,
50
,
100
,
500
,
1000
,
5000
,
10000
,
50000
)
v
=
(
1
,
5
,
10
,
50
,
100
,
500
,
1000
,
5000
,
10000
,
50000
)
if
sys
.
maxunicode
>=
100000
:
if
SIZEOF_WCHAR_T
==
4
:
v
+=
(
100000
,
500000
,
1000000
)
v
+=
(
100000
,
500000
,
1000000
)
s
=
""
.
join
([
chr
(
x
)
for
x
in
v
])
s
=
""
.
join
([
chr
(
x
)
for
x
in
v
])
codecs
.
register_error
(
"test.xmlcharrefreplace"
,
codecs
.
xmlcharrefreplace_errors
)
codecs
.
register_error
(
"test.xmlcharrefreplace"
,
codecs
.
xmlcharrefreplace_errors
)
...
...
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