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
d9faa201
Kaydet (Commit)
d9faa201
authored
Mar 26, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Read HTTP response inside transient_internet()
üst
006ba5c1
b651949f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
test_urllibnet.py
Lib/test/test_urllibnet.py
+10
-5
No files found.
Lib/test/test_urllibnet.py
Dosyayı görüntüle @
d9faa201
...
...
@@ -12,6 +12,7 @@ import time
class
URLTimeoutTest
(
unittest
.
TestCase
):
# XXX this test doesn't seem to test anything useful.
TIMEOUT
=
30.0
...
...
@@ -24,7 +25,7 @@ class URLTimeoutTest(unittest.TestCase):
def
testURLread
(
self
):
with
support
.
transient_internet
(
"www.python.org"
):
f
=
urllib
.
request
.
urlopen
(
"http://www.python.org/"
)
x
=
f
.
read
()
x
=
f
.
read
()
class
urlopenNetworkTests
(
unittest
.
TestCase
):
"""Tests urllib.reqest.urlopen using the network.
...
...
@@ -43,8 +44,10 @@ class urlopenNetworkTests(unittest.TestCase):
def
urlopen
(
self
,
*
args
,
**
kwargs
):
resource
=
args
[
0
]
with
support
.
transient_internet
(
resource
):
return
urllib
.
request
.
urlopen
(
*
args
,
**
kwargs
)
cm
=
support
.
transient_internet
(
resource
)
cm
.
__enter__
()
self
.
addCleanup
(
cm
.
__exit__
,
None
,
None
,
None
)
return
urllib
.
request
.
urlopen
(
*
args
,
**
kwargs
)
def
test_basic
(
self
):
# Simple test expected to pass.
...
...
@@ -135,8 +138,10 @@ class urlretrieveNetworkTests(unittest.TestCase):
def
urlretrieve
(
self
,
*
args
):
resource
=
args
[
0
]
with
support
.
transient_internet
(
resource
):
return
urllib
.
request
.
urlretrieve
(
*
args
)
cm
=
support
.
transient_internet
(
resource
)
cm
.
__enter__
()
self
.
addCleanup
(
cm
.
__exit__
,
None
,
None
,
None
)
return
urllib
.
request
.
urlretrieve
(
*
args
)
def
test_basic
(
self
):
# Test basic functionality.
...
...
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