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
a46ed118
Kaydet (Commit)
a46ed118
authored
Mar 31, 2011
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move assertBytesEqual to base test class, improve it, and hook into assertEqual
üst
eb50e51a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
__init__.py
Lib/test/test_email/__init__.py
+11
-0
test_email.py
Lib/test/test_email/test_email.py
+1
-6
No files found.
Lib/test/test_email/__init__.py
Dosyayı görüntüle @
a46ed118
...
@@ -25,6 +25,10 @@ def openfile(filename, *args, **kws):
...
@@ -25,6 +25,10 @@ def openfile(filename, *args, **kws):
# Base test class
# Base test class
class
TestEmailBase
(
unittest
.
TestCase
):
class
TestEmailBase
(
unittest
.
TestCase
):
def
__init__
(
self
,
*
args
,
**
kw
):
super
()
.
__init__
(
*
args
,
**
kw
)
self
.
addTypeEqualityFunc
(
bytes
,
self
.
assertBytesEqual
)
def
ndiffAssertEqual
(
self
,
first
,
second
):
def
ndiffAssertEqual
(
self
,
first
,
second
):
"""Like assertEqual except use ndiff for readable output."""
"""Like assertEqual except use ndiff for readable output."""
if
first
!=
second
:
if
first
!=
second
:
...
@@ -38,3 +42,10 @@ class TestEmailBase(unittest.TestCase):
...
@@ -38,3 +42,10 @@ class TestEmailBase(unittest.TestCase):
def
_msgobj
(
self
,
filename
):
def
_msgobj
(
self
,
filename
):
with
openfile
(
filename
)
as
fp
:
with
openfile
(
filename
)
as
fp
:
return
email
.
message_from_file
(
fp
)
return
email
.
message_from_file
(
fp
)
def
_bytes_repr
(
self
,
b
):
return
[
repr
(
x
)
for
x
in
b
.
splitlines
(
True
)]
def
assertBytesEqual
(
self
,
first
,
second
,
msg
):
"""Our byte strings are really encoded strings; improve diff output"""
self
.
assertEqual
(
self
.
_bytes_repr
(
first
),
self
.
_bytes_repr
(
second
))
Lib/test/test_email/test_email.py
Dosyayı görüntüle @
a46ed118
...
@@ -3161,12 +3161,7 @@ class BaseTestBytesGeneratorIdempotent:
...
@@ -3161,12 +3161,7 @@ class BaseTestBytesGeneratorIdempotent:
b
=
BytesIO
()
b
=
BytesIO
()
g
=
email
.
generator
.
BytesGenerator
(
b
,
maxheaderlen
=
0
)
g
=
email
.
generator
.
BytesGenerator
(
b
,
maxheaderlen
=
0
)
g
.
flatten
(
msg
,
unixfrom
=
unixfrom
,
linesep
=
self
.
linesep
)
g
.
flatten
(
msg
,
unixfrom
=
unixfrom
,
linesep
=
self
.
linesep
)
self
.
assertByteStringsEqual
(
data
,
b
.
getvalue
())
self
.
assertEqual
(
data
,
b
.
getvalue
())
def
assertByteStringsEqual
(
self
,
str1
,
str2
):
# Not using self.blinesep here is intentional. This way the output
# is more useful when the failure results in mixed line endings.
self
.
assertListEqual
(
str1
.
split
(
b
'
\n
'
),
str2
.
split
(
b
'
\n
'
))
class
TestBytesGeneratorIdempotentNL
(
BaseTestBytesGeneratorIdempotent
,
class
TestBytesGeneratorIdempotentNL
(
BaseTestBytesGeneratorIdempotent
,
...
...
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