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
e151d218
Kaydet (Commit)
e151d218
authored
Tem 17, 2011
tarafından
Alex Gaynor
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Mark itertools tests of tuple reuse as being specific to CPython.
üst
3121547f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
test_itertools.py
Lib/test/test_itertools.py
+15
-6
No files found.
Lib/test/test_itertools.py
Dosyayı görüntüle @
e151d218
...
...
@@ -168,7 +168,8 @@ class TestBasicOps(unittest.TestCase):
self
.
assertEqual
(
result
,
list
(
combinations2
(
values
,
r
)))
# matches second pure python version
self
.
assertEqual
(
result
,
list
(
combinations3
(
values
,
r
)))
# matches second pure python version
# Test implementation detail: tuple re-use
@support.impl_detail
(
"tuple reuse is specific to CPython"
)
def
test_combinations_tuple_reuse
(
self
):
self
.
assertEqual
(
len
(
set
(
map
(
id
,
combinations
(
'abcde'
,
3
)))),
1
)
self
.
assertNotEqual
(
len
(
set
(
map
(
id
,
list
(
combinations
(
'abcde'
,
3
))))),
1
)
...
...
@@ -238,7 +239,9 @@ class TestBasicOps(unittest.TestCase):
self
.
assertEqual
(
result
,
list
(
cwr1
(
values
,
r
)))
# matches first pure python version
self
.
assertEqual
(
result
,
list
(
cwr2
(
values
,
r
)))
# matches second pure python version
# Test implementation detail: tuple re-use
@support.impl_detail
(
"tuple reuse is specific to CPython"
)
def
test_combinations_with_replacement_tuple_reuse
(
self
):
cwr
=
combinations_with_replacement
self
.
assertEqual
(
len
(
set
(
map
(
id
,
cwr
(
'abcde'
,
3
)))),
1
)
self
.
assertNotEqual
(
len
(
set
(
map
(
id
,
list
(
cwr
(
'abcde'
,
3
))))),
1
)
...
...
@@ -302,7 +305,8 @@ class TestBasicOps(unittest.TestCase):
self
.
assertEqual
(
result
,
list
(
permutations
(
values
,
None
)))
# test r as None
self
.
assertEqual
(
result
,
list
(
permutations
(
values
)))
# test default r
# Test implementation detail: tuple re-use
@support.impl_detail
(
"tuple resuse is CPython specific"
)
def
test_permutations_tuple_reuse
(
self
):
self
.
assertEqual
(
len
(
set
(
map
(
id
,
permutations
(
'abcde'
,
3
)))),
1
)
self
.
assertNotEqual
(
len
(
set
(
map
(
id
,
list
(
permutations
(
'abcde'
,
3
))))),
1
)
...
...
@@ -566,11 +570,13 @@ class TestBasicOps(unittest.TestCase):
self
.
assertEqual
(
list
(
zip
()),
lzip
())
self
.
assertRaises
(
TypeError
,
zip
,
3
)
self
.
assertRaises
(
TypeError
,
zip
,
range
(
3
),
3
)
# Check tuple re-use (implementation detail)
self
.
assertEqual
([
tuple
(
list
(
pair
))
for
pair
in
zip
(
'abc'
,
'def'
)],
lzip
(
'abc'
,
'def'
))
self
.
assertEqual
([
pair
for
pair
in
zip
(
'abc'
,
'def'
)],
lzip
(
'abc'
,
'def'
))
@support.impl_detail
(
"tuple reuse is specific to CPython"
)
def
test_zip_tuple_reuse
(
self
):
ids
=
list
(
map
(
id
,
zip
(
'abc'
,
'def'
)))
self
.
assertEqual
(
min
(
ids
),
max
(
ids
))
ids
=
list
(
map
(
id
,
list
(
zip
(
'abc'
,
'def'
))))
...
...
@@ -613,11 +619,13 @@ class TestBasicOps(unittest.TestCase):
else
:
self
.
fail
(
'Did not raise Type in: '
+
stmt
)
# Check tuple re-use (implementation detail)
self
.
assertEqual
([
tuple
(
list
(
pair
))
for
pair
in
zip_longest
(
'abc'
,
'def'
)],
list
(
zip
(
'abc'
,
'def'
)))
self
.
assertEqual
([
pair
for
pair
in
zip_longest
(
'abc'
,
'def'
)],
list
(
zip
(
'abc'
,
'def'
)))
@support.impl_detail
(
"tuple reuse is specific to CPython"
)
def
test_zip_longest_tuple_reuse
(
self
):
ids
=
list
(
map
(
id
,
zip_longest
(
'abc'
,
'def'
)))
self
.
assertEqual
(
min
(
ids
),
max
(
ids
))
ids
=
list
(
map
(
id
,
list
(
zip_longest
(
'abc'
,
'def'
))))
...
...
@@ -721,7 +729,8 @@ class TestBasicOps(unittest.TestCase):
args
=
map
(
iter
,
args
)
self
.
assertEqual
(
len
(
list
(
product
(
*
args
))),
expected_len
)
# Test implementation detail: tuple re-use
@support.impl_detail
(
"tuple reuse is specific to CPython"
)
def
test_product_tuple_reuse
(
self
):
self
.
assertEqual
(
len
(
set
(
map
(
id
,
product
(
'abc'
,
'def'
)))),
1
)
self
.
assertNotEqual
(
len
(
set
(
map
(
id
,
list
(
product
(
'abc'
,
'def'
))))),
1
)
...
...
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