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
080c9974
Kaydet (Commit)
080c9974
authored
Ock 28, 2001
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added several more urlencode test cases - part of patch 103391
üst
14f1ad4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
3 deletions
+60
-3
test_urllib.py
Lib/test/test_urllib.py
+60
-3
No files found.
Lib/test/test_urllib.py
Dosyayı görüntüle @
080c9974
...
...
@@ -35,18 +35,75 @@ out2_2 = "abc?def"
verify
(
urllib
.
quote
(
in2
)
==
out2_1
,
"urllib.quote problem 4"
)
verify
(
urllib
.
quote
(
in2
,
'?'
)
==
out2_2
,
"urllib.quote problem 5"
)
in3
=
{
"p1"
:
"v1"
,
"p2"
:
"v2"
}
in3list
=
[(
"p1"
,
"v1"
),
(
"p2"
,
"v2"
)]
exp3_1
=
"p2=v2&p1=v1"
exp3_2
=
"p1=v1&p2=v2"
# dict input, only string values
act3
=
urllib
.
urlencode
(
in3
)
verify
(
act3
==
exp3_1
or
act3
==
exp3_2
,
"urllib.urlencode problem 1"
)
verify
(
act3
==
exp3_1
or
act3
==
exp3_2
,
"urllib.urlencode problem 1 dict"
)
# list input, only string values
act3list
=
urllib
.
urlencode
(
in3list
)
verify
(
act3list
==
exp3_2
,
"urllib.urlencode problem 1 list"
)
in4
=
{
"p1"
:[
"v1"
,
"v2"
]}
in4list
=
[(
"p1"
,
[
"v1"
,
"v2"
])]
exp4
=
"p1=v1&p1=v2"
# dict input, list values, doseq==1
act4
=
urllib
.
urlencode
(
in4
,
doseq
=
1
)
verify
(
act4
==
exp4
,
"urllib.urlencode problem 2"
)
verify
(
act4
==
exp4
,
"urllib.urlencode problem 2 dict"
)
# list input, list values, doseq==1
act4list
=
urllib
.
urlencode
(
in4
,
doseq
=
1
)
verify
(
act4list
==
exp4
,
"urllib.urlencode problem 2 list"
)
in5
=
in4
in5list
=
in4list
exp5
=
"p1=
%5
B
%27
v1
%27%2
C+
%27
v2
%27%5
D"
exp5list
=
"p1=
%5
B
%27
v1
%27%2
C+
%27
v2
%27%5
D"
# dict input, list variables, doseq=0
act5
=
urllib
.
urlencode
(
in5
)
verify
(
act5
==
exp5
,
"urllib.urlencode problem 3"
)
verify
(
act5
==
exp5
,
"urllib.urlencode problem 3 dict"
)
# list input, list variables, doseq=0
act5list
=
urllib
.
urlencode
(
in5list
)
verify
(
act5list
==
exp5list
,
"urllib.urlencode problem 3 list"
)
in6
=
{
"p1"
:
"v1"
,
"p2"
:
"v2"
}
in6list
=
[(
"p1"
,
"v1"
),
(
"p2"
,
"v2"
)]
exp6_1
=
"p2=v2&p1=v1"
exp6_2
=
"p1=v1&p2=v2"
# dict input, only string values, doseq==1
act6
=
urllib
.
urlencode
(
in6
,
doseq
=
1
)
verify
(
act6
==
exp6_1
or
act6
==
exp6_2
,
"urllib.urlencode problem 4 dict"
)
# list input, only string values
act6list
=
urllib
.
urlencode
(
in6list
,
doseq
=
1
)
verify
(
act6list
==
exp6_2
,
"urllib.urlencode problem 4 list"
)
in7
=
"p1=v1&p2=v2"
try
:
act7
=
urllib
.
urlencode
(
in7
)
print
"urllib.urlencode problem 5 string"
except
TypeError
:
pass
import
UserDict
in8
=
UserDict
.
UserDict
()
in8
[
"p1"
]
=
"v1"
in8
[
"p2"
]
=
[
"v1"
,
"v2"
]
exp8_1
=
"p1=v1&p2=v1&p2=v2"
exp8_2
=
"p2=v1&p2=v2&p1=v1"
act8
=
urllib
.
urlencode
(
in8
,
doseq
=
1
)
verify
(
act8
==
exp8_1
or
act8
==
exp8_2
,
"urllib.urlencode problem 6 UserDict"
)
import
UserString
in9
=
UserString
.
UserString
(
""
)
exp9
=
""
act9
=
urllib
.
urlencode
(
in9
,
doseq
=
1
)
verify
(
act9
==
exp9
,
"urllib.urlencode problem 7 UserString"
)
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