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
e41bb0bc
Kaydet (Commit)
e41bb0bc
authored
May 07, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Testsuite for RFC3986 based parsing scenario. Related Issue1462525.
üst
02f7b990
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
6 deletions
+52
-6
test_urlparse.py
Lib/test/test_urlparse.py
+52
-6
No files found.
Lib/test/test_urlparse.py
Dosyayı görüntüle @
e41bb0bc
...
@@ -6,7 +6,7 @@ import urlparse
...
@@ -6,7 +6,7 @@ import urlparse
RFC1808_BASE
=
"http://a/b/c/d;p?q#f"
RFC1808_BASE
=
"http://a/b/c/d;p?q#f"
RFC2396_BASE
=
"http://a/b/c/d;p?q"
RFC2396_BASE
=
"http://a/b/c/d;p?q"
RFC3986_BASE
=
"http://a/b/c/d;p?q"
RFC3986_BASE
=
'http://a/b/c/d;p?q'
# A list of test cases. Each test case is a a two-tuple that contains
# A list of test cases. Each test case is a a two-tuple that contains
# a string with the query and a dictionary with the expected result.
# a string with the query and a dictionary with the expected result.
...
@@ -234,14 +234,60 @@ class UrlParseTestCase(unittest.TestCase):
...
@@ -234,14 +234,60 @@ class UrlParseTestCase(unittest.TestCase):
self
.
checkJoin
(
RFC2396_BASE
,
'g#s/./x'
,
'http://a/b/c/g#s/./x'
)
self
.
checkJoin
(
RFC2396_BASE
,
'g#s/./x'
,
'http://a/b/c/g#s/./x'
)
self
.
checkJoin
(
RFC2396_BASE
,
'g#s/../x'
,
'http://a/b/c/g#s/../x'
)
self
.
checkJoin
(
RFC2396_BASE
,
'g#s/../x'
,
'http://a/b/c/g#s/../x'
)
#The following scenarios have been updated in RFC3986
#self.checkJoin(RFC2396_BASE, '?y', 'http://a/b/c/?y')
#self.checkJoin(RFC2396_BASE, ';x', 'http://a/b/c/;x')
def
test_RFC3986
(
self
):
def
test_RFC3986
(
self
):
# Test cases from RFC3986
self
.
checkJoin
(
RFC3986_BASE
,
'?y'
,
'http://a/b/c/d;p?y'
)
self
.
checkJoin
(
RFC3986_BASE
,
'?y'
,
'http://a/b/c/d;p?y'
)
self
.
checkJoin
(
RFC2396_BASE
,
';x'
,
'http://a/b/c/;x'
)
self
.
checkJoin
(
RFC2396_BASE
,
';x'
,
'http://a/b/c/;x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g:h'
,
'g:h'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g'
,
'http://a/b/c/g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'./g'
,
'http://a/b/c/g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g/'
,
'http://a/b/c/g/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'/g'
,
'http://a/g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'//g'
,
'http://g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'?y'
,
'http://a/b/c/d;p?y'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g?y'
,
'http://a/b/c/g?y'
)
self
.
checkJoin
(
RFC3986_BASE
,
'#s'
,
'http://a/b/c/d;p?q#s'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g#s'
,
'http://a/b/c/g#s'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g?y#s'
,
'http://a/b/c/g?y#s'
)
self
.
checkJoin
(
RFC3986_BASE
,
';x'
,
'http://a/b/c/;x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g;x'
,
'http://a/b/c/g;x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g;x?y#s'
,
'http://a/b/c/g;x?y#s'
)
self
.
checkJoin
(
RFC3986_BASE
,
''
,
'http://a/b/c/d;p?q'
)
self
.
checkJoin
(
RFC3986_BASE
,
'.'
,
'http://a/b/c/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'./'
,
'http://a/b/c/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'..'
,
'http://a/b/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'../'
,
'http://a/b/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'../g'
,
'http://a/b/g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'../..'
,
'http://a/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'../../'
,
'http://a/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'../../g'
,
'http://a/g'
)
#Abnormal Examples
# The 'abnormal scenarios' are incompatible with RFC2986 parsing
# Tests are here for reference.
#self.checkJoin(RFC3986_BASE, '../../../g','http://a/g')
#self.checkJoin(RFC3986_BASE, '../../../../g','http://a/g')
#self.checkJoin(RFC3986_BASE, '/./g','http://a/g')
#self.checkJoin(RFC3986_BASE, '/../g','http://a/g')
self
.
checkJoin
(
RFC3986_BASE
,
'g.'
,
'http://a/b/c/g.'
)
self
.
checkJoin
(
RFC3986_BASE
,
'.g'
,
'http://a/b/c/.g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g..'
,
'http://a/b/c/g..'
)
self
.
checkJoin
(
RFC3986_BASE
,
'..g'
,
'http://a/b/c/..g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'./../g'
,
'http://a/b/g'
)
self
.
checkJoin
(
RFC3986_BASE
,
'./g/.'
,
'http://a/b/c/g/'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g/./h'
,
'http://a/b/c/g/h'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g/../h'
,
'http://a/b/c/h'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g;x=1/./y'
,
'http://a/b/c/g;x=1/y'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g;x=1/../y'
,
'http://a/b/c/y'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g?y/./x'
,
'http://a/b/c/g?y/./x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g?y/../x'
,
'http://a/b/c/g?y/../x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g#s/./x'
,
'http://a/b/c/g#s/./x'
)
self
.
checkJoin
(
RFC3986_BASE
,
'g#s/../x'
,
'http://a/b/c/g#s/../x'
)
#self.checkJoin(RFC3986_BASE, 'http:g','http:g') # strict parser
self
.
checkJoin
(
RFC3986_BASE
,
'http:g'
,
'http://a/b/c/g'
)
# relaxed parser
def
test_RFC2732
(
self
):
def
test_RFC2732
(
self
):
for
url
,
hostname
,
port
in
[
for
url
,
hostname
,
port
in
[
...
...
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