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
ab5ba791
Kaydet (Commit)
ab5ba791
authored
Nis 19, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#17790: test_set now works with unittest test discovery. Patch by Zachary Ware.
üst
3e4a98bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
84 deletions
+34
-84
test_set.py
Lib/test/test_set.py
+31
-84
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_set.py
Dosyayı görüntüle @
ab5ba791
...
@@ -37,7 +37,7 @@ class HashCountingInt(int):
...
@@ -37,7 +37,7 @@ class HashCountingInt(int):
self
.
hash_count
+=
1
self
.
hash_count
+=
1
return
int
.
__hash__
(
self
)
return
int
.
__hash__
(
self
)
class
TestJointOps
(
unittest
.
TestCase
)
:
class
TestJointOps
:
# Tests common to both set and frozenset
# Tests common to both set and frozenset
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -361,7 +361,7 @@ class TestJointOps(unittest.TestCase):
...
@@ -361,7 +361,7 @@ class TestJointOps(unittest.TestCase):
gc
.
collect
()
gc
.
collect
()
self
.
assertTrue
(
ref
()
is
None
,
"Cycle was not collected"
)
self
.
assertTrue
(
ref
()
is
None
,
"Cycle was not collected"
)
class
TestSet
(
TestJointOps
):
class
TestSet
(
TestJointOps
,
unittest
.
TestCase
):
thetype
=
set
thetype
=
set
basetype
=
set
basetype
=
set
...
@@ -647,7 +647,7 @@ class TestSetSubclassWithKeywordArgs(TestSet):
...
@@ -647,7 +647,7 @@ class TestSetSubclassWithKeywordArgs(TestSet):
'SF bug #1486663 -- this used to erroneously raise a TypeError'
'SF bug #1486663 -- this used to erroneously raise a TypeError'
SetSubclassWithKeywordArgs
(
newarg
=
1
)
SetSubclassWithKeywordArgs
(
newarg
=
1
)
class
TestFrozenSet
(
TestJointOps
):
class
TestFrozenSet
(
TestJointOps
,
unittest
.
TestCase
):
thetype
=
frozenset
thetype
=
frozenset
basetype
=
frozenset
basetype
=
frozenset
...
@@ -748,7 +748,7 @@ empty_set = set()
...
@@ -748,7 +748,7 @@ empty_set = set()
#==============================================================================
#==============================================================================
class
TestBasicOps
(
unittest
.
TestCase
)
:
class
TestBasicOps
:
def
test_repr
(
self
):
def
test_repr
(
self
):
if
self
.
repr
is
not
None
:
if
self
.
repr
is
not
None
:
...
@@ -860,7 +860,7 @@ class TestBasicOps(unittest.TestCase):
...
@@ -860,7 +860,7 @@ class TestBasicOps(unittest.TestCase):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsEmpty
(
TestBasicOps
):
class
TestBasicOpsEmpty
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"empty set"
self
.
case
=
"empty set"
self
.
values
=
[]
self
.
values
=
[]
...
@@ -871,7 +871,7 @@ class TestBasicOpsEmpty(TestBasicOps):
...
@@ -871,7 +871,7 @@ class TestBasicOpsEmpty(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsSingleton
(
TestBasicOps
):
class
TestBasicOpsSingleton
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"unit set (number)"
self
.
case
=
"unit set (number)"
self
.
values
=
[
3
]
self
.
values
=
[
3
]
...
@@ -888,7 +888,7 @@ class TestBasicOpsSingleton(TestBasicOps):
...
@@ -888,7 +888,7 @@ class TestBasicOpsSingleton(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsTuple
(
TestBasicOps
):
class
TestBasicOpsTuple
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"unit set (tuple)"
self
.
case
=
"unit set (tuple)"
self
.
values
=
[(
0
,
"zero"
)]
self
.
values
=
[(
0
,
"zero"
)]
...
@@ -905,7 +905,7 @@ class TestBasicOpsTuple(TestBasicOps):
...
@@ -905,7 +905,7 @@ class TestBasicOpsTuple(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsTriple
(
TestBasicOps
):
class
TestBasicOpsTriple
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"triple set"
self
.
case
=
"triple set"
self
.
values
=
[
0
,
"zero"
,
operator
.
add
]
self
.
values
=
[
0
,
"zero"
,
operator
.
add
]
...
@@ -916,7 +916,7 @@ class TestBasicOpsTriple(TestBasicOps):
...
@@ -916,7 +916,7 @@ class TestBasicOpsTriple(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsString
(
TestBasicOps
):
class
TestBasicOpsString
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"string set"
self
.
case
=
"string set"
self
.
values
=
[
"a"
,
"b"
,
"c"
]
self
.
values
=
[
"a"
,
"b"
,
"c"
]
...
@@ -929,7 +929,7 @@ class TestBasicOpsString(TestBasicOps):
...
@@ -929,7 +929,7 @@ class TestBasicOpsString(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsBytes
(
TestBasicOps
):
class
TestBasicOpsBytes
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
case
=
"string set"
self
.
case
=
"string set"
self
.
values
=
[
b
"a"
,
b
"b"
,
b
"c"
]
self
.
values
=
[
b
"a"
,
b
"b"
,
b
"c"
]
...
@@ -942,7 +942,7 @@ class TestBasicOpsBytes(TestBasicOps):
...
@@ -942,7 +942,7 @@ class TestBasicOpsBytes(TestBasicOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestBasicOpsMixedStringBytes
(
TestBasicOps
):
class
TestBasicOpsMixedStringBytes
(
TestBasicOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_warning_filters
=
support
.
check_warnings
()
self
.
_warning_filters
=
support
.
check_warnings
()
self
.
_warning_filters
.
__enter__
()
self
.
_warning_filters
.
__enter__
()
...
@@ -1241,7 +1241,7 @@ class TestMutate(unittest.TestCase):
...
@@ -1241,7 +1241,7 @@ class TestMutate(unittest.TestCase):
#==============================================================================
#==============================================================================
class
TestSubsets
(
unittest
.
TestCase
)
:
class
TestSubsets
:
case2method
=
{
"<="
:
"issubset"
,
case2method
=
{
"<="
:
"issubset"
,
">="
:
"issuperset"
,
">="
:
"issuperset"
,
...
@@ -1279,7 +1279,7 @@ class TestSubsets(unittest.TestCase):
...
@@ -1279,7 +1279,7 @@ class TestSubsets(unittest.TestCase):
self
.
assertEqual
(
result
,
expected
)
self
.
assertEqual
(
result
,
expected
)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestSubsetEqualEmpty
(
TestSubsets
):
class
TestSubsetEqualEmpty
(
TestSubsets
,
unittest
.
TestCase
):
left
=
set
()
left
=
set
()
right
=
set
()
right
=
set
()
name
=
"both empty"
name
=
"both empty"
...
@@ -1287,7 +1287,7 @@ class TestSubsetEqualEmpty(TestSubsets):
...
@@ -1287,7 +1287,7 @@ class TestSubsetEqualEmpty(TestSubsets):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestSubsetEqualNonEmpty
(
TestSubsets
):
class
TestSubsetEqualNonEmpty
(
TestSubsets
,
unittest
.
TestCase
):
left
=
set
([
1
,
2
])
left
=
set
([
1
,
2
])
right
=
set
([
1
,
2
])
right
=
set
([
1
,
2
])
name
=
"equal pair"
name
=
"equal pair"
...
@@ -1295,7 +1295,7 @@ class TestSubsetEqualNonEmpty(TestSubsets):
...
@@ -1295,7 +1295,7 @@ class TestSubsetEqualNonEmpty(TestSubsets):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestSubsetEmptyNonEmpty
(
TestSubsets
):
class
TestSubsetEmptyNonEmpty
(
TestSubsets
,
unittest
.
TestCase
):
left
=
set
()
left
=
set
()
right
=
set
([
1
,
2
])
right
=
set
([
1
,
2
])
name
=
"one empty, one non-empty"
name
=
"one empty, one non-empty"
...
@@ -1303,7 +1303,7 @@ class TestSubsetEmptyNonEmpty(TestSubsets):
...
@@ -1303,7 +1303,7 @@ class TestSubsetEmptyNonEmpty(TestSubsets):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestSubsetPartial
(
TestSubsets
):
class
TestSubsetPartial
(
TestSubsets
,
unittest
.
TestCase
):
left
=
set
([
1
])
left
=
set
([
1
])
right
=
set
([
1
,
2
])
right
=
set
([
1
,
2
])
name
=
"one a non-empty proper subset of other"
name
=
"one a non-empty proper subset of other"
...
@@ -1311,7 +1311,7 @@ class TestSubsetPartial(TestSubsets):
...
@@ -1311,7 +1311,7 @@ class TestSubsetPartial(TestSubsets):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestSubsetNonOverlap
(
TestSubsets
):
class
TestSubsetNonOverlap
(
TestSubsets
,
unittest
.
TestCase
):
left
=
set
([
1
])
left
=
set
([
1
])
right
=
set
([
2
])
right
=
set
([
2
])
name
=
"neither empty, neither contains"
name
=
"neither empty, neither contains"
...
@@ -1319,7 +1319,7 @@ class TestSubsetNonOverlap(TestSubsets):
...
@@ -1319,7 +1319,7 @@ class TestSubsetNonOverlap(TestSubsets):
#==============================================================================
#==============================================================================
class
TestOnlySetsInBinaryOps
(
unittest
.
TestCase
)
:
class
TestOnlySetsInBinaryOps
:
def
test_eq_ne
(
self
):
def
test_eq_ne
(
self
):
# Unlike the others, this is testing that == and != *are* allowed.
# Unlike the others, this is testing that == and != *are* allowed.
...
@@ -1435,7 +1435,7 @@ class TestOnlySetsInBinaryOps(unittest.TestCase):
...
@@ -1435,7 +1435,7 @@ class TestOnlySetsInBinaryOps(unittest.TestCase):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsNumeric
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsNumeric
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
((
1
,
2
,
3
))
self
.
set
=
set
((
1
,
2
,
3
))
self
.
other
=
19
self
.
other
=
19
...
@@ -1443,7 +1443,7 @@ class TestOnlySetsNumeric(TestOnlySetsInBinaryOps):
...
@@ -1443,7 +1443,7 @@ class TestOnlySetsNumeric(TestOnlySetsInBinaryOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsDict
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsDict
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
((
1
,
2
,
3
))
self
.
set
=
set
((
1
,
2
,
3
))
self
.
other
=
{
1
:
2
,
3
:
4
}
self
.
other
=
{
1
:
2
,
3
:
4
}
...
@@ -1451,7 +1451,7 @@ class TestOnlySetsDict(TestOnlySetsInBinaryOps):
...
@@ -1451,7 +1451,7 @@ class TestOnlySetsDict(TestOnlySetsInBinaryOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsOperator
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsOperator
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
((
1
,
2
,
3
))
self
.
set
=
set
((
1
,
2
,
3
))
self
.
other
=
operator
.
add
self
.
other
=
operator
.
add
...
@@ -1459,7 +1459,7 @@ class TestOnlySetsOperator(TestOnlySetsInBinaryOps):
...
@@ -1459,7 +1459,7 @@ class TestOnlySetsOperator(TestOnlySetsInBinaryOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsTuple
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsTuple
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
((
1
,
2
,
3
))
self
.
set
=
set
((
1
,
2
,
3
))
self
.
other
=
(
2
,
4
,
6
)
self
.
other
=
(
2
,
4
,
6
)
...
@@ -1467,7 +1467,7 @@ class TestOnlySetsTuple(TestOnlySetsInBinaryOps):
...
@@ -1467,7 +1467,7 @@ class TestOnlySetsTuple(TestOnlySetsInBinaryOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsString
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsString
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
((
1
,
2
,
3
))
self
.
set
=
set
((
1
,
2
,
3
))
self
.
other
=
'abc'
self
.
other
=
'abc'
...
@@ -1475,7 +1475,7 @@ class TestOnlySetsString(TestOnlySetsInBinaryOps):
...
@@ -1475,7 +1475,7 @@ class TestOnlySetsString(TestOnlySetsInBinaryOps):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestOnlySetsGenerator
(
TestOnlySetsInBinaryOps
):
class
TestOnlySetsGenerator
(
TestOnlySetsInBinaryOps
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
def
gen
():
def
gen
():
for
i
in
range
(
0
,
10
,
2
):
for
i
in
range
(
0
,
10
,
2
):
...
@@ -1486,7 +1486,7 @@ class TestOnlySetsGenerator(TestOnlySetsInBinaryOps):
...
@@ -1486,7 +1486,7 @@ class TestOnlySetsGenerator(TestOnlySetsInBinaryOps):
#==============================================================================
#==============================================================================
class
TestCopying
(
unittest
.
TestCase
)
:
class
TestCopying
:
def
test_copy
(
self
):
def
test_copy
(
self
):
dup
=
self
.
set
.
copy
()
dup
=
self
.
set
.
copy
()
...
@@ -1507,31 +1507,31 @@ class TestCopying(unittest.TestCase):
...
@@ -1507,31 +1507,31 @@ class TestCopying(unittest.TestCase):
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestCopyingEmpty
(
TestCopying
):
class
TestCopyingEmpty
(
TestCopying
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
()
self
.
set
=
set
()
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestCopyingSingleton
(
TestCopying
):
class
TestCopyingSingleton
(
TestCopying
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
([
"hello"
])
self
.
set
=
set
([
"hello"
])
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestCopyingTriple
(
TestCopying
):
class
TestCopyingTriple
(
TestCopying
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
([
"zero"
,
0
,
None
])
self
.
set
=
set
([
"zero"
,
0
,
None
])
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestCopyingTuple
(
TestCopying
):
class
TestCopyingTuple
(
TestCopying
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
([(
1
,
2
)])
self
.
set
=
set
([(
1
,
2
)])
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
class
TestCopyingNested
(
TestCopying
):
class
TestCopyingNested
(
TestCopying
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set
=
set
([((
1
,
2
),
(
3
,
4
))])
self
.
set
=
set
([((
1
,
2
),
(
3
,
4
))])
...
@@ -1837,58 +1837,5 @@ class TestGraphs(unittest.TestCase):
...
@@ -1837,58 +1837,5 @@ class TestGraphs(unittest.TestCase):
#==============================================================================
#==============================================================================
def
test_main
(
verbose
=
None
):
test_classes
=
(
TestSet
,
TestSetSubclass
,
TestSetSubclassWithKeywordArgs
,
TestFrozenSet
,
TestFrozenSetSubclass
,
TestSetOfSets
,
TestExceptionPropagation
,
TestBasicOpsEmpty
,
TestBasicOpsSingleton
,
TestBasicOpsTuple
,
TestBasicOpsTriple
,
TestBasicOpsString
,
TestBasicOpsBytes
,
TestBasicOpsMixedStringBytes
,
TestBinaryOps
,
TestUpdateOps
,
TestMutate
,
TestSubsetEqualEmpty
,
TestSubsetEqualNonEmpty
,
TestSubsetEmptyNonEmpty
,
TestSubsetPartial
,
TestSubsetNonOverlap
,
TestOnlySetsNumeric
,
TestOnlySetsDict
,
TestOnlySetsOperator
,
TestOnlySetsTuple
,
TestOnlySetsString
,
TestOnlySetsGenerator
,
TestCopyingEmpty
,
TestCopyingSingleton
,
TestCopyingTriple
,
TestCopyingTuple
,
TestCopyingNested
,
TestIdentities
,
TestVariousIteratorArgs
,
TestGraphs
,
TestWeirdBugs
,
)
support
.
run_unittest
(
*
test_classes
)
# verify reference counting
if
verbose
and
hasattr
(
sys
,
"gettotalrefcount"
):
import
gc
counts
=
[
None
]
*
5
for
i
in
range
(
len
(
counts
)):
support
.
run_unittest
(
*
test_classes
)
gc
.
collect
()
counts
[
i
]
=
sys
.
gettotalrefcount
()
print
(
counts
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_main
(
verbose
=
True
)
unittest
.
main
(
)
Misc/NEWS
Dosyayı görüntüle @
ab5ba791
...
@@ -120,6 +120,9 @@ Tests
...
@@ -120,6 +120,9 @@ Tests
-
Issue
#
12820
:
add
tests
for
the
xml
.
dom
.
minicompat
module
.
-
Issue
#
12820
:
add
tests
for
the
xml
.
dom
.
minicompat
module
.
Patch
by
John
Chandler
and
Phil
Connell
.
Patch
by
John
Chandler
and
Phil
Connell
.
-
Issue
#
17790
:
test_set
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
-
Issue
#
17789
:
test_random
now
works
with
unittest
test
discovery
.
-
Issue
#
17789
:
test_random
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
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