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
aeff57d3
Kaydet (Commit)
aeff57d3
authored
Nis 16, 2016
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improve the coverage of urlparse module. Backport to 2.7 branch.
üst
bf02d188
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
test_urlparse.py
Lib/test/test_urlparse.py
+52
-0
No files found.
Lib/test/test_urlparse.py
Dosyayı görüntüle @
aeff57d3
...
...
@@ -22,6 +22,49 @@ parse_qsl_test_cases = [
(
"&a=b"
,
[(
'a'
,
'b'
)]),
(
"a=a+b&b=b+c"
,
[(
'a'
,
'a b'
),
(
'b'
,
'b c'
)]),
(
"a=1&a=2"
,
[(
'a'
,
'1'
),
(
'a'
,
'2'
)]),
(
";"
,
[]),
(
";;"
,
[]),
(
";a=b"
,
[(
'a'
,
'b'
)]),
(
"a=a+b;b=b+c"
,
[(
'a'
,
'a b'
),
(
'b'
,
'b c'
)]),
(
"a=1;a=2"
,
[(
'a'
,
'1'
),
(
'a'
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1;a=2"
,
{
b
'a'
:
[
b
'1'
,
b
'2'
]}),
]
class
UrlParseTestCase
(
unittest
.
TestCase
):
...
...
@@ -86,6 +129,15 @@ class UrlParseTestCase(unittest.TestCase):
self
.
assertEqual
(
result
,
expect_without_blanks
,
"Error parsing
%
r"
%
orig
)
def
test_qs
(
self
):
for
orig
,
expect
in
parse_qs_test_cases
:
result
=
urlparse
.
parse_qs
(
orig
,
keep_blank_values
=
True
)
self
.
assertEqual
(
result
,
expect
,
"Error parsing
%
r"
%
orig
)
expect_without_blanks
=
dict
(
[(
v
,
expect
[
v
])
for
v
in
expect
if
len
(
expect
[
v
][
0
])])
result
=
urlparse
.
parse_qs
(
orig
,
keep_blank_values
=
False
)
self
.
assertEqual
(
result
,
expect_without_blanks
,
"Error parsing
%
r"
%
orig
)
def
test_roundtrips
(
self
):
testcases
=
[
...
...
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