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
482ee66c
Kaydet (Commit)
482ee66c
authored
Şub 15, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #7644: Add tests for the file argument of NNTP.head() and NNTP.body().
Patch by Hynek Schlawack.
üst
43df889d
2640b522
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
test_nntplib.py
Lib/test/test_nntplib.py
+40
-0
No files found.
Lib/test/test_nntplib.py
Dosyayı görüntüle @
482ee66c
...
...
@@ -1000,6 +1000,26 @@ class NNTPv1v2TestsMixin:
self
.
server
.
head
(
"<non-existent@example.com>"
)
self
.
assertEqual
(
cm
.
exception
.
response
,
"430 No Such Article Found"
)
def
test_head_file
(
self
):
f
=
io
.
BytesIO
()
resp
,
info
=
self
.
server
.
head
(
file
=
f
)
self
.
assertEqual
(
resp
,
"221 3000237 <45223423@example.com>"
)
art_num
,
message_id
,
lines
=
info
self
.
assertEqual
(
art_num
,
3000237
)
self
.
assertEqual
(
message_id
,
"<45223423@example.com>"
)
self
.
assertEqual
(
lines
,
[])
data
=
f
.
getvalue
()
self
.
assertTrue
(
data
.
startswith
(
b
'From: "Demo User" <nobody@example.net>
\r\n
'
b
'Subject: I am just a test article
\r\n
'
),
ascii
(
data
))
self
.
assertFalse
(
data
.
endswith
(
b
'This is just a test article.
\r\n
'
b
'.Here is a dot-starting line.
\r\n
'
b
'
\r\n
'
b
'-- Signed by Andr
\xc3\xa9
.
\r\n
'
),
ascii
(
data
))
def
test_body
(
self
):
# BODY
resp
,
info
=
self
.
server
.
body
()
...
...
@@ -1027,6 +1047,26 @@ class NNTPv1v2TestsMixin:
self
.
server
.
body
(
"<non-existent@example.com>"
)
self
.
assertEqual
(
cm
.
exception
.
response
,
"430 No Such Article Found"
)
def
test_body_file
(
self
):
f
=
io
.
BytesIO
()
resp
,
info
=
self
.
server
.
body
(
file
=
f
)
self
.
assertEqual
(
resp
,
"222 3000237 <45223423@example.com>"
)
art_num
,
message_id
,
lines
=
info
self
.
assertEqual
(
art_num
,
3000237
)
self
.
assertEqual
(
message_id
,
"<45223423@example.com>"
)
self
.
assertEqual
(
lines
,
[])
data
=
f
.
getvalue
()
self
.
assertFalse
(
data
.
startswith
(
b
'From: "Demo User" <nobody@example.net>
\r\n
'
b
'Subject: I am just a test article
\r\n
'
),
ascii
(
data
))
self
.
assertTrue
(
data
.
endswith
(
b
'This is just a test article.
\r\n
'
b
'.Here is a dot-starting line.
\r\n
'
b
'
\r\n
'
b
'-- Signed by Andr
\xc3\xa9
.
\r\n
'
),
ascii
(
data
))
def
check_over_xover_resp
(
self
,
resp
,
overviews
):
self
.
assertTrue
(
resp
.
startswith
(
"224 "
),
resp
)
self
.
assertEqual
(
len
(
overviews
),
3
)
...
...
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