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
d17ad8d6
Kaydet (Commit)
d17ad8d6
authored
Ock 27, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Stronger tests for combinatoric relationships.
üst
eb508ad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
test_itertools.py
Lib/test/test_itertools.py
+5
-1
No files found.
Lib/test/test_itertools.py
Dosyayı görüntüle @
d17ad8d6
...
...
@@ -285,11 +285,15 @@ class TestBasicOps(unittest.TestCase):
perm
=
list
(
permutations
(
s
,
r
))
comb
=
list
(
combinations
(
s
,
r
))
self
.
assertEquals
(
len
(
prod
),
len
(
s
)
**
r
)
self
.
assertEquals
(
prod
,
sorted
(
set
(
prod
)))
# prod in lexicographic order without repeats
self
.
assertEquals
(
cwr
,
[
t
for
t
in
prod
if
sorted
(
t
)
==
list
(
t
)])
# cwr: prods which are sorted
self
.
assertEquals
(
perm
,
[
t
for
t
in
prod
if
len
(
set
(
t
))
==
r
])
# perm: prods with no dups
self
.
assertEqual
(
comb
,
[
t
for
t
in
perm
if
sorted
(
t
)
==
list
(
t
)])
# comb: perms that are sorted
self
.
assertEqual
(
comb
,
[
t
for
t
in
cwr
if
len
(
set
(
t
))
==
r
])
# comb: cwrs without dups
self
.
assertEqual
(
set
(
comb
),
set
(
cwr
)
&
set
(
perm
))
# comb: both a cwr and a perm
self
.
assertEqual
(
comb
,
list
(
filter
(
set
(
cwr
)
.
__contains__
,
perm
)))
# comb: perm that is a cwr
self
.
assertEqual
(
comb
,
list
(
filter
(
set
(
perm
)
.
__contains__
,
cwr
)))
# comb: cwr that is a perm
self
.
assertEqual
(
comb
,
sorted
(
set
(
cwr
)
&
set
(
perm
)))
# comb: both a cwr and a perm
def
test_compress
(
self
):
self
.
assertEqual
(
list
(
compress
(
'ABCDEF'
,
[
1
,
0
,
1
,
0
,
1
,
1
])),
list
(
'ACEF'
))
...
...
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