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
91c9da34
Kaydet (Commit)
91c9da34
authored
Mar 20, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 7832. Deprecating assertSameElements in Py3k.
üst
8442a606
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
23 deletions
+7
-23
test_unittest.py
Lib/test/test_unittest.py
+2
-19
case.py
Lib/unittest/case.py
+5
-4
No files found.
Lib/test/test_unittest.py
Dosyayı görüntüle @
91c9da34
...
...
@@ -2758,24 +2758,6 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
self
.
assertRaises
(
self
.
failureException
,
self
.
assertDictEqual
,
[],
d
)
self
.
assertRaises
(
self
.
failureException
,
self
.
assertDictEqual
,
1
,
1
)
self
.
assertSameElements
([
1
,
2
,
3
],
[
3
,
2
,
1
])
self
.
assertSameElements
([
1
,
2
]
+
[
3
]
*
100
,
[
1
]
*
100
+
[
2
,
3
])
self
.
assertSameElements
([
'foo'
,
'bar'
,
'baz'
],
[
'bar'
,
'baz'
,
'foo'
])
self
.
assertRaises
(
self
.
failureException
,
self
.
assertSameElements
,
[
10
],
[
10
,
11
])
self
.
assertRaises
(
self
.
failureException
,
self
.
assertSameElements
,
[
10
,
11
],
[
10
])
# Test that sequences of unhashable objects can be tested for sameness:
self
.
assertSameElements
([[
1
,
2
],
[
3
,
4
]],
[[
3
,
4
],
[
1
,
2
]])
self
.
assertSameElements
([{
'a'
:
1
},
{
'b'
:
2
}],
[{
'b'
:
2
},
{
'a'
:
1
}])
self
.
assertRaises
(
self
.
failureException
,
self
.
assertSameElements
,
[[
1
]],
[[
2
]])
self
.
assertRaises
(
self
.
failureException
,
self
.
assertSameElements
,
[{
'a'
:
1
},
{
'b'
:
2
}],
[{
'b'
:
2
},
{
'a'
:
2
}])
def
testAssertItemsEqual
(
self
):
a
=
object
()
self
.
assertItemsEqual
([
1
,
2
,
3
],
[
3
,
2
,
1
])
...
...
@@ -3032,7 +3014,8 @@ test case
(
self
.
failIfAlmostEqual
,
(
3.0
,
5.0
)),
(
self
.
failUnless
,
(
True
,)),
(
self
.
failUnlessRaises
,
(
TypeError
,
lambda
_
:
3.14
+
'spam'
)),
(
self
.
failIf
,
(
False
,))
(
self
.
failIf
,
(
False
,)),
(
self
.
assertSameElements
,
([
1
,
1
,
2
,
3
],
[
1
,
2
,
3
]))
)
for
meth
,
args
in
old
:
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
...
...
Lib/unittest/case.py
Dosyayı görüntüle @
91c9da34
...
...
@@ -700,10 +700,9 @@ class TestCase(object):
msg: Optional message to use on failure instead of a list of
differences.
For more general containership equality, assertSameElements will work
with things other than sets. This uses ducktyping to support
different types of sets, and is optimized for sets specifically
(parameters must support a difference method).
assertSetEqual uses ducktyping to support different types of sets, and
is optimized for sets specifically (parameters must support a
difference method).
"""
try
:
difference1
=
set1
.
difference
(
set2
)
...
...
@@ -809,6 +808,8 @@ class TestCase(object):
set(actual))`` but it works with sequences of unhashable objects as
well.
"""
warnings
.
warn
(
'assertSameElements is deprecated'
,
DeprecationWarning
)
try
:
expected
=
set
(
expected_seq
)
actual
=
set
(
actual_seq
)
...
...
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