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
46809195
Kaydet (Commit)
46809195
authored
Eyl 25, 2012
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#15222: test_mailbox: End message template in a newline
üst
1654d74e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
test_mailbox.py
Lib/test/test_mailbox.py
+15
-15
No files found.
Lib/test/test_mailbox.py
Dosyayı görüntüle @
46809195
...
...
@@ -49,7 +49,7 @@ class TestMailbox(TestBase):
maxDiff
=
None
_factory
=
None
# Overridden by subclasses to reuse tests
_template
=
'From: foo
\n\n
%
s'
_template
=
'From: foo
\n\n
%
s
\n
'
def
setUp
(
self
):
self
.
_path
=
support
.
TESTFN
...
...
@@ -228,7 +228,7 @@ class TestMailbox(TestBase):
key0
=
self
.
_box
.
add
(
self
.
_template
%
0
)
msg
=
self
.
_box
.
get
(
key0
)
self
.
assertEqual
(
msg
[
'from'
],
'foo'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'0'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'0
\n
'
)
self
.
assertIs
(
self
.
_box
.
get
(
'foo'
),
None
)
self
.
assertIs
(
self
.
_box
.
get
(
'foo'
,
False
),
False
)
self
.
_box
.
close
()
...
...
@@ -236,14 +236,14 @@ class TestMailbox(TestBase):
key1
=
self
.
_box
.
add
(
self
.
_template
%
1
)
msg
=
self
.
_box
.
get
(
key1
)
self
.
assertEqual
(
msg
[
'from'
],
'foo'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'1'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'1
\n
'
)
def
test_getitem
(
self
):
# Retrieve message using __getitem__()
key0
=
self
.
_box
.
add
(
self
.
_template
%
0
)
msg
=
self
.
_box
[
key0
]
self
.
assertEqual
(
msg
[
'from'
],
'foo'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'0'
)
self
.
assertEqual
(
msg
.
get_payload
(),
'0
\n
'
)
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
_box
[
'foo'
])
self
.
_box
.
discard
(
key0
)
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
_box
[
key0
])
...
...
@@ -255,7 +255,7 @@ class TestMailbox(TestBase):
msg0
=
self
.
_box
.
get_message
(
key0
)
self
.
assertIsInstance
(
msg0
,
mailbox
.
Message
)
self
.
assertEqual
(
msg0
[
'from'
],
'foo'
)
self
.
assertEqual
(
msg0
.
get_payload
(),
'0'
)
self
.
assertEqual
(
msg0
.
get_payload
(),
'0
\n
'
)
self
.
_check_sample
(
self
.
_box
.
get_message
(
key1
))
def
test_get_bytes
(
self
):
...
...
@@ -428,15 +428,15 @@ class TestMailbox(TestBase):
self
.
assertIn
(
key0
,
self
.
_box
)
key1
=
self
.
_box
.
add
(
self
.
_template
%
1
)
self
.
assertIn
(
key1
,
self
.
_box
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key0
)
.
get_payload
(),
'0'
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key0
)
.
get_payload
(),
'0
\n
'
)
self
.
assertNotIn
(
key0
,
self
.
_box
)
self
.
assertIn
(
key1
,
self
.
_box
)
key2
=
self
.
_box
.
add
(
self
.
_template
%
2
)
self
.
assertIn
(
key2
,
self
.
_box
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key2
)
.
get_payload
(),
'2'
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key2
)
.
get_payload
(),
'2
\n
'
)
self
.
assertNotIn
(
key2
,
self
.
_box
)
self
.
assertIn
(
key1
,
self
.
_box
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key1
)
.
get_payload
(),
'1'
)
self
.
assertEqual
(
self
.
_box
.
pop
(
key1
)
.
get_payload
(),
'1
\n
'
)
self
.
assertNotIn
(
key1
,
self
.
_box
)
self
.
assertEqual
(
len
(
self
.
_box
),
0
)
...
...
@@ -631,7 +631,7 @@ class TestMaildir(TestMailbox, unittest.TestCase):
msg_returned
=
self
.
_box
.
get_message
(
key
)
self
.
assertEqual
(
msg_returned
.
get_subdir
(),
'new'
)
self
.
assertEqual
(
msg_returned
.
get_flags
(),
''
)
self
.
assertEqual
(
msg_returned
.
get_payload
(),
'1'
)
self
.
assertEqual
(
msg_returned
.
get_payload
(),
'1
\n
'
)
msg2
=
mailbox
.
MaildirMessage
(
self
.
_template
%
2
)
msg2
.
set_info
(
'2,S'
)
self
.
_box
[
key
]
=
msg2
...
...
@@ -639,7 +639,7 @@ class TestMaildir(TestMailbox, unittest.TestCase):
msg_returned
=
self
.
_box
.
get_message
(
key
)
self
.
assertEqual
(
msg_returned
.
get_subdir
(),
'new'
)
self
.
assertEqual
(
msg_returned
.
get_flags
(),
'S'
)
self
.
assertEqual
(
msg_returned
.
get_payload
(),
'3'
)
self
.
assertEqual
(
msg_returned
.
get_payload
(),
'3
\n
'
)
def
test_consistent_factory
(
self
):
# Add a message.
...
...
@@ -993,20 +993,20 @@ class _TestMboxMMDF(_TestSingleFile):
def
test_add_from_string
(
self
):
# Add a string starting with 'From ' to the mailbox
key
=
self
.
_box
.
add
(
'From foo@bar blah
\n
From: foo
\n\n
0'
)
key
=
self
.
_box
.
add
(
'From foo@bar blah
\n
From: foo
\n\n
0
\n
'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_from
(),
'foo@bar blah'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_payload
(),
'0'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_payload
(),
'0
\n
'
)
def
test_add_from_bytes
(
self
):
# Add a byte string starting with 'From ' to the mailbox
key
=
self
.
_box
.
add
(
b
'From foo@bar blah
\n
From: foo
\n\n
0'
)
key
=
self
.
_box
.
add
(
b
'From foo@bar blah
\n
From: foo
\n\n
0
\n
'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_from
(),
'foo@bar blah'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_payload
(),
'0'
)
self
.
assertEqual
(
self
.
_box
[
key
]
.
get_payload
(),
'0
\n
'
)
def
test_add_mbox_or_mmdf_message
(
self
):
# Add an mboxMessage or MMDFMessage
for
class_
in
(
mailbox
.
mboxMessage
,
mailbox
.
MMDFMessage
):
msg
=
class_
(
'From foo@bar blah
\n
From: foo
\n\n
0'
)
msg
=
class_
(
'From foo@bar blah
\n
From: foo
\n\n
0
\n
'
)
key
=
self
.
_box
.
add
(
msg
)
def
test_open_close_open
(
self
):
...
...
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