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
81e7f940
Kaydet (Commit)
81e7f940
authored
Nis 25, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5
üst
ccd047ea
685fbed7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
3 deletions
+83
-3
case.py
Lib/unittest/case.py
+3
-3
test_case.py
Lib/unittest/test/test_case.py
+76
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/unittest/case.py
Dosyayı görüntüle @
81e7f940
...
...
@@ -964,7 +964,7 @@ class TestCase(object):
if
item1
!=
item2
:
differing
+=
(
'
\n
First differing element
%
d:
\n
%
s
\n
%
s
\n
'
%
(
i
,
item1
,
item2
))
(
(
i
,)
+
_common_shorten_repr
(
item1
,
item2
)
))
break
else
:
if
(
len1
==
len2
and
seq_type
is
None
and
...
...
@@ -977,7 +977,7 @@ class TestCase(object):
'elements.
\n
'
%
(
seq_type_name
,
len1
-
len2
))
try
:
differing
+=
(
'First extra element
%
d:
\n
%
s
\n
'
%
(
len2
,
s
eq1
[
len2
]
))
(
len2
,
s
afe_repr
(
seq1
[
len2
])
))
except
(
TypeError
,
IndexError
,
NotImplementedError
):
differing
+=
(
'Unable to index element
%
d '
'of first
%
s
\n
'
%
(
len2
,
seq_type_name
))
...
...
@@ -986,7 +986,7 @@ class TestCase(object):
'elements.
\n
'
%
(
seq_type_name
,
len2
-
len1
))
try
:
differing
+=
(
'First extra element
%
d:
\n
%
s
\n
'
%
(
len1
,
s
eq2
[
len1
]
))
(
len1
,
s
afe_repr
(
seq2
[
len1
])
))
except
(
TypeError
,
IndexError
,
NotImplementedError
):
differing
+=
(
'Unable to index element
%
d '
'of second
%
s
\n
'
%
(
len1
,
seq_type_name
))
...
...
Lib/unittest/test/test_case.py
Dosyayı görüntüle @
81e7f940
...
...
@@ -1121,6 +1121,82 @@ test case
error
=
str
(
e
)
.
split
(
'
\n
'
,
1
)[
1
]
self
.
assertEqual
(
sample_text_error
,
error
)
def
testEqualityBytesWarning
(
self
):
if
sys
.
flags
.
bytes_warning
:
def
bytes_warning
():
return
self
.
assertWarnsRegex
(
BytesWarning
,
'Comparison between bytes and string'
)
else
:
def
bytes_warning
():
return
contextlib
.
ExitStack
()
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertEqual
(
'a'
,
b
'a'
)
with
bytes_warning
():
self
.
assertNotEqual
(
'a'
,
b
'a'
)
a
=
[
0
,
'a'
]
b
=
[
0
,
b
'a'
]
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertListEqual
(
a
,
b
)
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertTupleEqual
(
tuple
(
a
),
tuple
(
b
))
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
a
,
tuple
(
b
))
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
tuple
(
a
),
b
)
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
'a'
,
b
'a'
)
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSetEqual
(
set
(
a
),
set
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertListEqual
(
a
,
tuple
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertTupleEqual
(
tuple
(
a
),
b
)
a
=
[
0
,
b
'a'
]
b
=
[
0
]
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertListEqual
(
a
,
b
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertTupleEqual
(
tuple
(
a
),
tuple
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
a
,
tuple
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
tuple
(
a
),
b
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSetEqual
(
set
(
a
),
set
(
b
))
a
=
[
0
]
b
=
[
0
,
b
'a'
]
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertListEqual
(
a
,
b
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertTupleEqual
(
tuple
(
a
),
tuple
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
a
,
tuple
(
b
))
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSequenceEqual
(
tuple
(
a
),
b
)
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertSetEqual
(
set
(
a
),
set
(
b
))
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictEqual
({
'a'
:
0
},
{
b
'a'
:
0
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictEqual
({},
{
b
'a'
:
0
})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictEqual
({
b
'a'
:
0
},
{})
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertCountEqual
([
b
'a'
,
b
'a'
],
[
b
'a'
,
b
'a'
,
b
'a'
])
with
bytes_warning
():
self
.
assertCountEqual
([
'a'
,
b
'a'
],
[
'a'
,
b
'a'
])
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertCountEqual
([
'a'
,
'a'
],
[
b
'a'
,
b
'a'
])
with
bytes_warning
(),
self
.
assertRaises
(
self
.
failureException
):
self
.
assertCountEqual
([
'a'
,
'a'
,
[]],
[
b
'a'
,
b
'a'
,
[]])
def
testAssertIsNone
(
self
):
self
.
assertIsNone
(
None
)
self
.
assertRaises
(
self
.
failureException
,
self
.
assertIsNone
,
False
)
...
...
Misc/NEWS
Dosyayı görüntüle @
81e7f940
...
...
@@ -256,6 +256,10 @@ Core and Builtins
Library
-------
- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified
differing items (like bytes in the -b mode). This affects assertListEqual()
and assertTupleEqual().
- Issue #26041: Remove "will be removed in Python 3.7" from deprecation
messages of platform.dist() and platform.linux_distribution().
Patch by Kumaripaba Miyurusara Athukorala.
...
...
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