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
bb2734ab
Kaydet (Commit)
bb2734ab
authored
Şub 14, 2003
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Port test_charmapcodec to PyUnit. From SF patch #662807
üst
002a5de2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
44 deletions
+32
-44
test_charmapcodec
Lib/test/output/test_charmapcodec
+0
-16
test_charmapcodec.py
Lib/test/test_charmapcodec.py
+32
-28
No files found.
Lib/test/output/test_charmapcodec
deleted
100644 → 0
Dosyayı görüntüle @
002a5de2
test_charmapcodec
abc == abc: OK
abcdef == abcdef: OK
defabc == defabc: OK
dabcf == dabcf: OK
dabcfabc == dabcfabc: OK
abc == abc: OK
abcdef == abcdef: OK
defabc == defabc: OK
dabcf == dabcf: OK
dabcfabc == dabcfabc: OK
def == def: OK
def == def: OK
df == df: OK
df == df: OK
\001 maps to undefined: OK
Lib/test/test_charmapcodec.py
Dosyayı görüntüle @
bb2734ab
...
...
@@ -9,35 +9,39 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
"""
#"
def
check
(
a
,
b
):
if
a
!=
b
:
print
'*** check failed:
%
s !=
%
s'
%
(
repr
(
a
),
repr
(
b
))
else
:
print
'
%
s ==
%
s: OK'
%
(
a
,
b
)
import
test.test_support
,
unittest
# test codec's full path name (see test/testcodec.py)
codecname
=
'test.testcodec'
check
(
unicode
(
'abc'
,
codecname
),
u'abc'
)
check
(
unicode
(
'xdef'
,
codecname
),
u'abcdef'
)
check
(
unicode
(
'defx'
,
codecname
),
u'defabc'
)
check
(
unicode
(
'dxf'
,
codecname
),
u'dabcf'
)
check
(
unicode
(
'dxfx'
,
codecname
),
u'dabcfabc'
)
check
(
u'abc'
.
encode
(
codecname
),
'abc'
)
check
(
u'xdef'
.
encode
(
codecname
),
'abcdef'
)
check
(
u'defx'
.
encode
(
codecname
),
'defabc'
)
check
(
u'dxf'
.
encode
(
codecname
),
'dabcf'
)
check
(
u'dxfx'
.
encode
(
codecname
),
'dabcfabc'
)
check
(
unicode
(
'ydef'
,
codecname
),
u'def'
)
check
(
unicode
(
'defy'
,
codecname
),
u'def'
)
check
(
unicode
(
'dyf'
,
codecname
),
u'df'
)
check
(
unicode
(
'dyfy'
,
codecname
),
u'df'
)
try
:
unicode
(
'abc
\001
'
,
codecname
)
except
UnicodeError
:
print
'
\\
001 maps to undefined: OK'
else
:
print
'*** check failed:
\\
001 does not map to undefined'
class
CharmapCodecTest
(
unittest
.
TestCase
):
def
test_constructorx
(
self
):
self
.
assertEquals
(
unicode
(
'abc'
,
codecname
),
u'abc'
)
self
.
assertEquals
(
unicode
(
'xdef'
,
codecname
),
u'abcdef'
)
self
.
assertEquals
(
unicode
(
'defx'
,
codecname
),
u'defabc'
)
self
.
assertEquals
(
unicode
(
'dxf'
,
codecname
),
u'dabcf'
)
self
.
assertEquals
(
unicode
(
'dxfx'
,
codecname
),
u'dabcfabc'
)
def
test_encodex
(
self
):
self
.
assertEquals
(
u'abc'
.
encode
(
codecname
),
'abc'
)
self
.
assertEquals
(
u'xdef'
.
encode
(
codecname
),
'abcdef'
)
self
.
assertEquals
(
u'defx'
.
encode
(
codecname
),
'defabc'
)
self
.
assertEquals
(
u'dxf'
.
encode
(
codecname
),
'dabcf'
)
self
.
assertEquals
(
u'dxfx'
.
encode
(
codecname
),
'dabcfabc'
)
def
test_constructory
(
self
):
self
.
assertEquals
(
unicode
(
'ydef'
,
codecname
),
u'def'
)
self
.
assertEquals
(
unicode
(
'defy'
,
codecname
),
u'def'
)
self
.
assertEquals
(
unicode
(
'dyf'
,
codecname
),
u'df'
)
self
.
assertEquals
(
unicode
(
'dyfy'
,
codecname
),
u'df'
)
def
test_maptoundefined
(
self
):
self
.
assertRaises
(
UnicodeError
,
unicode
,
'abc
\001
'
,
codecname
)
def
test_main
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
CharmapCodecTest
))
test
.
test_support
.
run_suite
(
suite
)
if
__name__
==
"__main__"
:
test_main
()
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