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
d13c008b
Kaydet (Commit)
d13c008b
authored
Nis 17, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#17766: test_iterlen now works with unittest test discovery. Patch by Zachary Ware.
üst
c048d985
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
32 deletions
+17
-32
test_iterlen.py
Lib/test/test_iterlen.py
+14
-32
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_iterlen.py
Dosyayı görüntüle @
d13c008b
...
...
@@ -60,7 +60,7 @@ def len(obj):
except
AttributeError
:
raise
TypeError
class
TestInvariantWithoutMutations
(
unittest
.
TestCase
)
:
class
TestInvariantWithoutMutations
:
def
test_invariant
(
self
):
it
=
self
.
it
...
...
@@ -87,7 +87,7 @@ class TestTemporarilyImmutable(TestInvariantWithoutMutations):
## ------- Concrete Type Tests -------
class
TestRepeat
(
TestInvariantWithoutMutations
):
class
TestRepeat
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
repeat
(
None
,
n
)
...
...
@@ -96,59 +96,59 @@ class TestRepeat(TestInvariantWithoutMutations):
# The repeat() object can also be infinite
self
.
assertRaises
(
TypeError
,
len
,
repeat
(
None
))
class
TestXrange
(
TestInvariantWithoutMutations
):
class
TestXrange
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
iter
(
range
(
n
))
class
TestXrangeCustomReversed
(
TestInvariantWithoutMutations
):
class
TestXrangeCustomReversed
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
reversed
(
range
(
n
))
class
TestTuple
(
TestInvariantWithoutMutations
):
class
TestTuple
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
iter
(
tuple
(
range
(
n
)))
## ------- Types that should not be mutated during iteration -------
class
TestDeque
(
TestTemporarilyImmutable
):
class
TestDeque
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
deque
(
range
(
n
))
self
.
it
=
iter
(
d
)
self
.
mutate
=
d
.
pop
class
TestDequeReversed
(
TestTemporarilyImmutable
):
class
TestDequeReversed
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
deque
(
range
(
n
))
self
.
it
=
reversed
(
d
)
self
.
mutate
=
d
.
pop
class
TestDictKeys
(
TestTemporarilyImmutable
):
class
TestDictKeys
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
dict
.
fromkeys
(
range
(
n
))
self
.
it
=
iter
(
d
)
self
.
mutate
=
d
.
popitem
class
TestDictItems
(
TestTemporarilyImmutable
):
class
TestDictItems
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
dict
.
fromkeys
(
range
(
n
))
self
.
it
=
iter
(
d
.
items
())
self
.
mutate
=
d
.
popitem
class
TestDictValues
(
TestTemporarilyImmutable
):
class
TestDictValues
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
dict
.
fromkeys
(
range
(
n
))
self
.
it
=
iter
(
d
.
values
())
self
.
mutate
=
d
.
popitem
class
TestSet
(
TestTemporarilyImmutable
):
class
TestSet
(
TestTemporarilyImmutable
,
unittest
.
TestCase
):
def
setUp
(
self
):
d
=
set
(
range
(
n
))
...
...
@@ -157,7 +157,7 @@ class TestSet(TestTemporarilyImmutable):
## ------- Types that can mutate during iteration -------
class
TestList
(
TestInvariantWithoutMutations
):
class
TestList
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
iter
(
range
(
n
))
...
...
@@ -176,7 +176,7 @@ class TestList(TestInvariantWithoutMutations):
d
.
extend
(
range
(
20
))
self
.
assertEqual
(
len
(
it
),
0
)
class
TestListReversed
(
TestInvariantWithoutMutations
):
class
TestListReversed
(
TestInvariantWithoutMutations
,
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
it
=
reversed
(
range
(
n
))
...
...
@@ -229,23 +229,5 @@ class TestLengthHintExceptions(unittest.TestCase):
self
.
assertEqual
(
list
(
NoneLengthHint
()),
list
(
range
(
10
)))
def
test_main
():
unittests
=
[
TestRepeat
,
TestXrange
,
TestXrangeCustomReversed
,
TestTuple
,
TestDeque
,
TestDequeReversed
,
TestDictKeys
,
TestDictItems
,
TestDictValues
,
TestSet
,
TestList
,
TestListReversed
,
TestLengthHintExceptions
,
]
support
.
run_unittest
(
*
unittests
)
if
__name__
==
"__main__"
:
test_
main
()
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
d13c008b
...
...
@@ -109,6 +109,9 @@ Tests
-
Issue
#
12820
:
add
tests
for
the
xml
.
dom
.
minicompat
module
.
Patch
by
John
Chandler
and
Phil
Connell
.
-
Issue
#
17766
:
test_iterlen
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
-
Issue
#
17690
:
test_time
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
...
...
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