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
225a099f
Kaydet (Commit)
225a099f
authored
Şub 18, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
unittest.TestCase uses safe_repr for producing failure messages. Partial fix for issue 7956
üst
456e1652
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
12 deletions
+26
-12
test_unittest.py
Lib/test/test_unittest.py
+20
-12
case.py
Lib/unittest/case.py
+0
-0
util.py
Lib/unittest/util.py
+6
-0
No files found.
Lib/test/test_unittest.py
Dosyayı görüntüle @
225a099f
...
...
@@ -17,6 +17,7 @@ from copy import deepcopy
from
cStringIO
import
StringIO
import
pickle
### Support code
################################################################
...
...
@@ -2557,21 +2558,28 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
self
.
assertDictContainsSubset
({
'a'
:
1
},
{
'a'
:
1
,
'b'
:
2
})
self
.
assertDictContainsSubset
({
'a'
:
1
,
'b'
:
2
},
{
'a'
:
1
,
'b'
:
2
})
self
.
assertRaises
(
unittest
.
TestCase
.
failureException
,
self
.
assertDictContainsSubset
,
{
'a'
:
2
},
{
'a'
:
1
},
'.*Mismatched values:.*'
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
1
:
"one"
},
{})
self
.
assertRaises
(
unittest
.
TestCase
.
failureException
,
self
.
assertDictContainsSubset
,
{
'c'
:
1
},
{
'a'
:
1
},
'.*Missing:.*'
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
2
},
{
'a'
:
1
})
self
.
assertRaises
(
unittest
.
TestCase
.
failureException
,
self
.
assertDictContainsSubset
,
{
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
},
'.*Missing:.*'
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'c'
:
1
},
{
'a'
:
1
})
self
.
assertRaises
(
unittest
.
TestCase
.
failureException
,
self
.
assertDictContainsSubset
,
{
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
},
'.*Missing:.*Mismatched values:.*'
)
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
})
@unittest.expectedFailure
def
test_crazy
(
self
):
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
two
=
u'
\uFFFD
'
first
=
{
'foo'
:
one
}
second
=
{
'foo'
:
two
}
self
.
assertDictContainsSubset
(
first
,
second
)
def
testAssertEqual
(
self
):
equal_pairs
=
[
...
...
Lib/unittest/case.py
Dosyayı görüntüle @
225a099f
This diff is collapsed.
Click to expand it.
Lib/unittest/util.py
Dosyayı görüntüle @
225a099f
"""Various utility functions."""
def
safe_repr
(
obj
):
try
:
return
repr
(
obj
)
except
Exception
:
return
object
.
__repr__
(
obj
)
def
strclass
(
cls
):
return
"
%
s.
%
s"
%
(
cls
.
__module__
,
cls
.
__name__
)
...
...
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