Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e38415e7
Commit
e38415e7
authored
Apr 16, 2016
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue26775 - Improve test coverage for urllib.parse
Patch contributed by Luiz Poleto.
parent
23172bd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
2 deletions
+53
-2
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+53
-2
No files found.
Lib/test/test_urlparse.py
View file @
e38415e7
...
...
@@ -17,7 +17,6 @@ parse_qsl_test_cases = [
(
"=a"
,
[(
''
,
'a'
)]),
(
"a"
,
[(
'a'
,
''
)]),
(
"a="
,
[(
'a'
,
''
)]),
(
"a="
,
[(
'a'
,
''
)]),
(
"&a=b"
,
[(
'a'
,
'b'
)]),
(
"a=a+b&b=b+c"
,
[(
'a'
,
'a b'
),
(
'b'
,
'b c'
)]),
(
"a=1&a=2"
,
[(
'a'
,
'1'
),
(
'a'
,
'2'
)]),
...
...
@@ -28,10 +27,52 @@ parse_qsl_test_cases = [
(
b"=a"
,
[(
b''
,
b'a'
)]),
(
b"a"
,
[(
b'a'
,
b''
)]),
(
b"a="
,
[(
b'a'
,
b''
)]),
(
b"a="
,
[(
b'a'
,
b''
)]),
(
b"&a=b"
,
[(
b'a'
,
b'b'
)]),
(
b"a=a+b&b=b+c"
,
[(
b'a'
,
b'a b'
),
(
b'b'
,
b'b c'
)]),
(
b"a=1&a=2"
,
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
b";"
,
{}),
(
b";;"
,
{}),
(
b";a=b"
,
{
b'a'
:
[
b'b'
]}),
(
b"a=a+b;b=b+c"
,
{
b'a'
:
[
b'a b'
],
b'b'
:
[
b'b c'
]}),
(
b"a=1;a=2"
,
{
b'a'
:
[
b'1'
,
b'2'
]}),
]
class
UrlParseTestCase
(
unittest
.
TestCase
):
...
...
@@ -96,6 +137,16 @@ 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
=
urllib
.
parse
.
parse_qs
(
orig
,
keep_blank_values
=
True
)
self
.
assertEqual
(
result
,
expect
,
"Error parsing %r"
%
orig
)
expect_without_blanks
=
{
v
:
expect
[
v
]
for
v
in
expect
if
len
(
expect
[
v
][
0
])}
result
=
urllib
.
parse
.
parse_qs
(
orig
,
keep_blank_values
=
False
)
self
.
assertEqual
(
result
,
expect_without_blanks
,
"Error parsing %r"
%
orig
)
def
test_roundtrips
(
self
):
str_cases
=
[
(
'file:///tmp/junk.txt'
,
...
...
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