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
2bdec7bf
Commit
2bdec7bf
authored
Sep 10, 2005
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert 1.170. Add tests.
parent
803ce801
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+6
-0
Lib/urllib.py
Lib/urllib.py
+6
-3
No files found.
Lib/test/test_urllib.py
View file @
2bdec7bf
...
...
@@ -353,6 +353,12 @@ class QuotingTests(unittest.TestCase):
self.assertEqual(expect, result,
"using quote_plus(): %s != %s" % (expect, result))
def test_quoting_plus(self):
self.assertEqual(urllib.quote_plus('
alpha
+
beta
gamma
'),
'
alpha
%
2
Bbeta
+
gamma
')
self.assertEqual(urllib.quote_plus('
alpha
+
beta
gamma
', '
+
'),
'
alpha
+
beta
+
gamma
')
class UnquotingTests(unittest.TestCase):
"""Tests for unquote() and unquote_plus()
...
...
Lib/urllib.py
View file @
2bdec7bf
...
...
@@ -1110,8 +1110,11 @@ def quote(s, safe = '/'):
def
quote_plus
(
s
,
safe
=
''
):
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
if
' '
in
s
:
s
=
s
.
replace
(
' '
,
'+'
)
safe
+=
'+'
l
=
s
.
split
(
' '
)
for
i
in
range
(
len
(
l
)):
l
[
i
]
=
quote
(
l
[
i
],
safe
)
return
'+'
.
join
(
l
)
else
:
return
quote
(
s
,
safe
)
def
urlencode
(
query
,
doseq
=
0
):
...
...
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