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
b78bb74c
Kaydet (Commit)
b78bb74c
authored
Ock 22, 2007
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improve pattern used for mbox 'From' lines; add a simple test
üst
5a096e1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
mailbox.py
Lib/mailbox.py
+4
-2
test_old_mailbox.py
Lib/test/test_old_mailbox.py
+34
-1
No files found.
Lib/mailbox.py
Dosyayı görüntüle @
b78bb74c
...
...
@@ -1995,8 +1995,10 @@ class UnixMailbox(_Mailbox):
# necessary. For convenience, we've added a PortableUnixMailbox class
# which uses the more lenient _fromlinepattern regular expression.
_fromlinepattern
=
r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
\
r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$"
_fromlinepattern
=
(
r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
r"[^\s]*\s*"
"$"
)
_regexp
=
None
def
_strict_isrealfromline
(
self
,
line
):
...
...
Lib/test/test_old_mailbox.py
Dosyayı görüntüle @
b78bb74c
...
...
@@ -109,11 +109,44 @@ class MaildirTestCase(unittest.TestCase):
self
.
assertEqual
(
len
(
str
(
msg
)),
len
(
FROM_
)
+
len
(
DUMMY_MESSAGE
))
self
.
assertEqual
(
n
,
1
)
class
MboxTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
# create a new maildir mailbox to work with:
self
.
_path
=
test_support
.
TESTFN
def
tearDown
(
self
):
os
.
unlink
(
self
.
_path
)
def
test_from_regex
(
self
):
# Testing new regex from bug #1633678
f
=
open
(
self
.
_path
,
'w'
)
f
.
write
(
"""From fred@example.com Mon May 31 13:24:50 2004 +0200
Subject: message 1
body1
From fred@example.com Mon May 31 13:24:50 2004 -0200
Subject: message 2
body2
From fred@example.com Mon May 31 13:24:50 2004
Subject: message 3
body3
From fred@example.com Mon May 31 13:24:50 2004
Subject: message 4
body4
"""
)
f
.
close
()
box
=
mailbox
.
UnixMailbox
(
open
(
self
.
_path
,
'r'
))
self
.
assert_
(
len
(
list
(
iter
(
box
)))
==
4
)
# XXX We still need more tests!
def
test_main
():
test_support
.
run_unittest
(
MaildirTestCase
)
test_support
.
run_unittest
(
MaildirTestCase
,
MboxTestCase
)
if
__name__
==
"__main__"
:
...
...
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