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
867b8258
Commit
867b8258
authored
Jun 03, 2018
by
Cheryl Sabella
Committed by
Serhiy Storchaka
Jun 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-27485: Change urlparse tests to use private methods. (GH-7070)
parent
027f95c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+12
-12
No files found.
Lib/test/test_urlparse.py
View file @
867b8258
...
...
@@ -994,7 +994,7 @@ class Utility_Tests(unittest.TestCase):
# In Python 2 this test class was in test_urllib.
def
test_splittype
(
self
):
splittype
=
urllib
.
parse
.
splittype
splittype
=
urllib
.
parse
.
_
splittype
self
.
assertEqual
(
splittype
(
'type:opaquestring'
),
(
'type'
,
'opaquestring'
))
self
.
assertEqual
(
splittype
(
'opaquestring'
),
(
None
,
'opaquestring'
))
self
.
assertEqual
(
splittype
(
':opaquestring'
),
(
None
,
':opaquestring'
))
...
...
@@ -1002,7 +1002,7 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
(
splittype
(
'type:opaque:string'
),
(
'type'
,
'opaque:string'
))
def
test_splithost
(
self
):
splithost
=
urllib
.
parse
.
splithost
splithost
=
urllib
.
parse
.
_
splithost
self
.
assertEqual
(
splithost
(
'//www.example.org:80/foo/bar/baz.html'
),
(
'www.example.org:80'
,
'/foo/bar/baz.html'
))
self
.
assertEqual
(
splithost
(
'//www.example.org:80'
),
...
...
@@ -1031,7 +1031,7 @@ class Utility_Tests(unittest.TestCase):
(
'example.net'
,
'/file#'
))
def
test_splituser
(
self
):
splituser
=
urllib
.
parse
.
splituser
splituser
=
urllib
.
parse
.
_
splituser
self
.
assertEqual
(
splituser
(
'User:Pass@www.python.org:080'
),
(
'User:Pass'
,
'www.python.org:080'
))
self
.
assertEqual
(
splituser
(
'@www.python.org:080'
),
...
...
@@ -1046,7 +1046,7 @@ class Utility_Tests(unittest.TestCase):
def
test_splitpasswd
(
self
):
# Some of the password examples are not sensible, but it is added to
# confirming to RFC2617 and addressing issue4675.
splitpasswd
=
urllib
.
parse
.
splitpasswd
splitpasswd
=
urllib
.
parse
.
_
splitpasswd
self
.
assertEqual
(
splitpasswd
(
'user:ab'
),
(
'user'
,
'ab'
))
self
.
assertEqual
(
splitpasswd
(
'user:a
\
n
b'
),
(
'user'
,
'a
\
n
b'
))
self
.
assertEqual
(
splitpasswd
(
'user:a
\
t
b'
),
(
'user'
,
'a
\
t
b'
))
...
...
@@ -1062,7 +1062,7 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
(
splitpasswd
(
':ab'
),
(
''
,
'ab'
))
def
test_splitport
(
self
):
splitport
=
urllib
.
parse
.
splitport
splitport
=
urllib
.
parse
.
_
splitport
self
.
assertEqual
(
splitport
(
'parrot:88'
),
(
'parrot'
,
'88'
))
self
.
assertEqual
(
splitport
(
'parrot'
),
(
'parrot'
,
None
))
self
.
assertEqual
(
splitport
(
'parrot:'
),
(
'parrot'
,
None
))
...
...
@@ -1073,7 +1073,7 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
(
splitport
(
':88'
),
(
''
,
'88'
))
def
test_splitnport
(
self
):
splitnport
=
urllib
.
parse
.
splitnport
splitnport
=
urllib
.
parse
.
_
splitnport
self
.
assertEqual
(
splitnport
(
'parrot:88'
),
(
'parrot'
,
88
))
self
.
assertEqual
(
splitnport
(
'parrot'
),
(
'parrot'
,
-
1
))
self
.
assertEqual
(
splitnport
(
'parrot'
,
55
),
(
'parrot'
,
55
))
...
...
@@ -1087,7 +1087,7 @@ class Utility_Tests(unittest.TestCase):
def
test_splitquery
(
self
):
# Normal cases are exercised by other tests; ensure that we also
# catch cases with no port specified (testcase ensuring coverage)
splitquery
=
urllib
.
parse
.
splitquery
splitquery
=
urllib
.
parse
.
_
splitquery
self
.
assertEqual
(
splitquery
(
'http://python.org/fake?foo=bar'
),
(
'http://python.org/fake'
,
'foo=bar'
))
self
.
assertEqual
(
splitquery
(
'http://python.org/fake?foo=bar?'
),
...
...
@@ -1097,7 +1097,7 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
(
splitquery
(
'?foo=bar'
),
(
''
,
'foo=bar'
))
def
test_splittag
(
self
):
splittag
=
urllib
.
parse
.
splittag
splittag
=
urllib
.
parse
.
_
splittag
self
.
assertEqual
(
splittag
(
'http://example.com?foo=bar#baz'
),
(
'http://example.com?foo=bar'
,
'baz'
))
self
.
assertEqual
(
splittag
(
'http://example.com?foo=bar#'
),
...
...
@@ -1109,7 +1109,7 @@ class Utility_Tests(unittest.TestCase):
(
'http://example.com?foo=bar#baz'
,
'boo'
))
def
test_splitattr
(
self
):
splitattr
=
urllib
.
parse
.
splitattr
splitattr
=
urllib
.
parse
.
_
splitattr
self
.
assertEqual
(
splitattr
(
'/path;attr1=value1;attr2=value2'
),
(
'/path'
,
[
'attr1=value1'
,
'attr2=value2'
]))
self
.
assertEqual
(
splitattr
(
'/path;'
),
(
'/path'
,
[
''
]))
...
...
@@ -1120,7 +1120,7 @@ class Utility_Tests(unittest.TestCase):
def
test_splitvalue
(
self
):
# Normal cases are exercised by other tests; test pathological cases
# with no key/value pairs. (testcase ensuring coverage)
splitvalue
=
urllib
.
parse
.
splitvalue
splitvalue
=
urllib
.
parse
.
_
splitvalue
self
.
assertEqual
(
splitvalue
(
'foo=bar'
),
(
'foo'
,
'bar'
))
self
.
assertEqual
(
splitvalue
(
'foo='
),
(
'foo'
,
''
))
self
.
assertEqual
(
splitvalue
(
'=bar'
),
(
''
,
'bar'
))
...
...
@@ -1128,13 +1128,13 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
(
splitvalue
(
'foo=bar=baz'
),
(
'foo'
,
'bar=baz'
))
def
test_to_bytes
(
self
):
result
=
urllib
.
parse
.
to_bytes
(
'http://www.python.org'
)
result
=
urllib
.
parse
.
_
to_bytes
(
'http://www.python.org'
)
self
.
assertEqual
(
result
,
'http://www.python.org'
)
self
.
assertRaises
(
UnicodeError
,
urllib
.
parse
.
_to_bytes
,
'http://www.python.org/medi
\
u00e6
val'
)
def
test_unwrap
(
self
):
url
=
urllib
.
parse
.
unwrap
(
'<URL:type://host/path>'
)
url
=
urllib
.
parse
.
_
unwrap
(
'<URL:type://host/path>'
)
self
.
assertEqual
(
url
,
'type://host/path'
)
...
...
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