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
cae969e7
Kaydet (Commit)
cae969e7
authored
Ock 03, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix test_unittest: ignore DeprecationWarning on assertDictContainsSubset()
üst
47f14bad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
24 deletions
+30
-24
test_assertions.py
Lib/unittest/test/test_assertions.py
+8
-5
test_case.py
Lib/unittest/test/test_case.py
+22
-19
No files found.
Lib/unittest/test/test_assertions.py
Dosyayı görüntüle @
cae969e7
import
datetime
import
warnings
import
unittest
...
...
@@ -224,10 +224,13 @@ class TestLongMessage(unittest.TestCase):
"
\
+
\
{'key': 'value'
\
} : oops$"
])
def
testAssertDictContainsSubset
(
self
):
self
.
assertMessages
(
'assertDictContainsSubset'
,
({
'key'
:
'value'
},
{}),
[
"^Missing: 'key'$"
,
"^oops$"
,
"^Missing: 'key'$"
,
"^Missing: 'key' : oops$"
])
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
,
DeprecationWarning
)
self
.
assertMessages
(
'assertDictContainsSubset'
,
({
'key'
:
'value'
},
{}),
[
"^Missing: 'key'$"
,
"^oops$"
,
"^Missing: 'key'$"
,
"^Missing: 'key' : oops$"
])
def
testAssertMultiLineEqual
(
self
):
self
.
assertMessages
(
'assertMultiLineEqual'
,
(
""
,
"foo"
),
...
...
Lib/unittest/test/test_case.py
Dosyayı görüntüle @
cae969e7
...
...
@@ -489,31 +489,34 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
animals
)
def
testAssertDictContainsSubset
(
self
):
self
.
assertDictContainsSubset
({},
{})
self
.
assertDictContainsSubset
({},
{
'a'
:
1
})
self
.
assertDictContainsSubset
({
'a'
:
1
},
{
'a'
:
1
})
self
.
assertDictContainsSubset
({
'a'
:
1
},
{
'a'
:
1
,
'b'
:
2
})
self
.
assertDictContainsSubset
({
'a'
:
1
,
'b'
:
2
},
{
'a'
:
1
,
'b'
:
2
})
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
,
DeprecationWarning
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
1
:
"one"
},
{})
self
.
assertDictContainsSubset
({},
{})
self
.
assertDictContainsSubset
({},
{
'a'
:
1
})
self
.
assertDictContainsSubset
({
'a'
:
1
},
{
'a'
:
1
})
self
.
assertDictContainsSubset
({
'a'
:
1
},
{
'a'
:
1
,
'b'
:
2
})
self
.
assertDictContainsSubset
({
'a'
:
1
,
'b'
:
2
},
{
'a'
:
1
,
'b'
:
2
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
2
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
1
:
"one"
},
{
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'c'
:
1
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
2
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'c'
:
1
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
# this used to cause a UnicodeDecodeError constructing the failure msg
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'foo'
:
one
},
{
'foo'
:
'
\uFFFD
'
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
# this used to cause a UnicodeDecodeError constructing the failure msg
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'foo'
:
one
},
{
'foo'
:
'
\uFFFD
'
})
def
testAssertEqual
(
self
):
equal_pairs
=
[
...
...
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