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
70d0ddab
Kaydet (Commit)
70d0ddab
authored
Agu 29, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make test_urllib be strict about str/bytes.
(One change to httplib.py, but not enough for test_httplib.)
üst
7436a063
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
httplib.py
Lib/httplib.py
+1
-1
test_urllib.py
Lib/test/test_urllib.py
+4
-4
No files found.
Lib/httplib.py
Dosyayı görüntüle @
70d0ddab
...
...
@@ -373,7 +373,7 @@ class HTTPResponse:
# Assume it's a Simple-Response from an 0.9 server.
# We have to convert the first line back to raw bytes
# because self.fp.readline() needs to return bytes.
self
.
fp
=
LineAndFileWrapper
(
bytes
(
line
),
self
.
fp
)
self
.
fp
=
LineAndFileWrapper
(
bytes
(
line
,
"ascii"
),
self
.
fp
)
return
"HTTP/0.9"
,
200
,
""
# The status code is a three-digit number
...
...
Lib/test/test_urllib.py
Dosyayı görüntüle @
70d0ddab
...
...
@@ -30,7 +30,7 @@ class urlopen_FileTests(unittest.TestCase):
def
setUp
(
self
):
"""Setup of a temp file to use for testing"""
self
.
text
=
bytes
(
"test_urllib:
%
s
\n
"
%
self
.
__class__
.
__name__
)
self
.
text
=
bytes
(
"test_urllib:
%
s
\n
"
%
self
.
__class__
.
__name__
,
"ascii"
)
FILE
=
open
(
test_support
.
TESTFN
,
'wb'
)
try
:
FILE
.
write
(
self
.
text
)
...
...
@@ -168,7 +168,7 @@ class urlretrieve_FileTests(unittest.TestCase):
def
constructLocalFileUrl
(
self
,
filePath
):
return
"file://
%
s"
%
urllib
.
pathname2url
(
os
.
path
.
abspath
(
filePath
))
def
createNewTempFile
(
self
,
data
=
""
):
def
createNewTempFile
(
self
,
data
=
b
""
):
"""Creates a new temporary file containing the specified data,
registers the file for deletion during the test fixture tear down, and
returns the absolute path of the file."""
...
...
@@ -246,7 +246,7 @@ class urlretrieve_FileTests(unittest.TestCase):
report
=
[]
def
hooktester
(
count
,
block_size
,
total_size
,
_report
=
report
):
_report
.
append
((
count
,
block_size
,
total_size
))
srcFileName
=
self
.
createNewTempFile
(
"x"
*
5
)
srcFileName
=
self
.
createNewTempFile
(
b
"x"
*
5
)
urllib
.
urlretrieve
(
self
.
constructLocalFileUrl
(
srcFileName
),
test_support
.
TESTFN
,
hooktester
)
self
.
assertEqual
(
len
(
report
),
2
)
...
...
@@ -260,7 +260,7 @@ class urlretrieve_FileTests(unittest.TestCase):
report
=
[]
def
hooktester
(
count
,
block_size
,
total_size
,
_report
=
report
):
_report
.
append
((
count
,
block_size
,
total_size
))
srcFileName
=
self
.
createNewTempFile
(
"x"
*
8193
)
srcFileName
=
self
.
createNewTempFile
(
b
"x"
*
8193
)
urllib
.
urlretrieve
(
self
.
constructLocalFileUrl
(
srcFileName
),
test_support
.
TESTFN
,
hooktester
)
self
.
assertEqual
(
len
(
report
),
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