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
ce584d42
Kaydet (Commit)
ce584d42
authored
Şub 21, 2008
tarafından
Eric Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved test_format into the correct TestCase.
üst
af16ece1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
39 deletions
+39
-39
test_builtin.py
Lib/test/test_builtin.py
+39
-39
No files found.
Lib/test/test_builtin.py
Dosyayı görüntüle @
ce584d42
...
...
@@ -1973,45 +1973,6 @@ class BuiltinTest(unittest.TestCase):
return
i
self
.
assertRaises
(
ValueError
,
zip
,
BadSeq
(),
BadSeq
())
class
TestSorted
(
unittest
.
TestCase
):
def
test_basic
(
self
):
data
=
range
(
100
)
copy
=
data
[:]
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
))
self
.
assertNotEqual
(
data
,
copy
)
data
.
reverse
()
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
cmp
=
lambda
x
,
y
:
cmp
(
y
,
x
)))
self
.
assertNotEqual
(
data
,
copy
)
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
key
=
lambda
x
:
-
x
))
self
.
assertNotEqual
(
data
,
copy
)
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
reverse
=
1
))
self
.
assertNotEqual
(
data
,
copy
)
def
test_inputtypes
(
self
):
s
=
'abracadabra'
types
=
[
list
,
tuple
]
if
have_unicode
:
types
.
insert
(
0
,
unicode
)
for
T
in
types
:
self
.
assertEqual
(
sorted
(
s
),
sorted
(
T
(
s
)))
s
=
''
.
join
(
dict
.
fromkeys
(
s
)
.
keys
())
# unique letters only
types
=
[
set
,
frozenset
,
list
,
tuple
,
dict
.
fromkeys
]
if
have_unicode
:
types
.
insert
(
0
,
unicode
)
for
T
in
types
:
self
.
assertEqual
(
sorted
(
s
),
sorted
(
T
(
s
)))
def
test_baddecorator
(
self
):
data
=
'The quick Brown fox Jumped over The lazy Dog'
.
split
()
self
.
assertRaises
(
TypeError
,
sorted
,
data
,
None
,
lambda
x
,
y
:
0
)
def
test_format
(
self
):
# Test the basic machinery of the format() builtin. Don't test
# the specifics of the various formatters
...
...
@@ -2107,6 +2068,45 @@ class TestSorted(unittest.TestCase):
class
DerivedFromStr
(
str
):
pass
self
.
assertEqual
(
format
(
0
,
DerivedFromStr
(
'10'
)),
' 0'
)
class
TestSorted
(
unittest
.
TestCase
):
def
test_basic
(
self
):
data
=
range
(
100
)
copy
=
data
[:]
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
))
self
.
assertNotEqual
(
data
,
copy
)
data
.
reverse
()
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
cmp
=
lambda
x
,
y
:
cmp
(
y
,
x
)))
self
.
assertNotEqual
(
data
,
copy
)
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
key
=
lambda
x
:
-
x
))
self
.
assertNotEqual
(
data
,
copy
)
random
.
shuffle
(
copy
)
self
.
assertEqual
(
data
,
sorted
(
copy
,
reverse
=
1
))
self
.
assertNotEqual
(
data
,
copy
)
def
test_inputtypes
(
self
):
s
=
'abracadabra'
types
=
[
list
,
tuple
]
if
have_unicode
:
types
.
insert
(
0
,
unicode
)
for
T
in
types
:
self
.
assertEqual
(
sorted
(
s
),
sorted
(
T
(
s
)))
s
=
''
.
join
(
dict
.
fromkeys
(
s
)
.
keys
())
# unique letters only
types
=
[
set
,
frozenset
,
list
,
tuple
,
dict
.
fromkeys
]
if
have_unicode
:
types
.
insert
(
0
,
unicode
)
for
T
in
types
:
self
.
assertEqual
(
sorted
(
s
),
sorted
(
T
(
s
)))
def
test_baddecorator
(
self
):
data
=
'The quick Brown fox Jumped over The lazy Dog'
.
split
()
self
.
assertRaises
(
TypeError
,
sorted
,
data
,
None
,
lambda
x
,
y
:
0
)
def
test_main
(
verbose
=
None
):
test_classes
=
(
BuiltinTest
,
TestSorted
)
...
...
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