forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-104139: Add itms-services to uses_netloc urllib.parse. (pyth…
…on#104312) Teach unsplit to retain the `"//"` when assembling `itms-services://?action=generate-bugs` style [Apple Platform Deployment](https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web) URLs.
- Loading branch information
Showing
3 changed files
with
23 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,20 +72,20 @@ class UrlParseTestCase(unittest.TestCase): | |
|
||
def checkRoundtrips(self, url, parsed, split): | ||
result = urllib.parse.urlparse(url) | ||
self.assertEqual(result, parsed) | ||
self.assertSequenceEqual(result, parsed) | ||
t = (result.scheme, result.netloc, result.path, | ||
result.params, result.query, result.fragment) | ||
self.assertEqual(t, parsed) | ||
self.assertSequenceEqual(t, parsed) | ||
# put it back together and it should be the same | ||
result2 = urllib.parse.urlunparse(result) | ||
self.assertEqual(result2, url) | ||
self.assertEqual(result2, result.geturl()) | ||
self.assertSequenceEqual(result2, url) | ||
self.assertSequenceEqual(result2, result.geturl()) | ||
|
||
# the result of geturl() is a fixpoint; we can always parse it | ||
# again to get the same result: | ||
result3 = urllib.parse.urlparse(result.geturl()) | ||
self.assertEqual(result3.geturl(), result.geturl()) | ||
self.assertEqual(result3, result) | ||
self.assertSequenceEqual(result3, result) | ||
self.assertEqual(result3.scheme, result.scheme) | ||
self.assertEqual(result3.netloc, result.netloc) | ||
self.assertEqual(result3.path, result.path) | ||
|
@@ -99,18 +99,18 @@ def checkRoundtrips(self, url, parsed, split): | |
|
||
# check the roundtrip using urlsplit() as well | ||
result = urllib.parse.urlsplit(url) | ||
self.assertEqual(result, split) | ||
self.assertSequenceEqual(result, split) | ||
t = (result.scheme, result.netloc, result.path, | ||
result.query, result.fragment) | ||
self.assertEqual(t, split) | ||
self.assertSequenceEqual(t, split) | ||
result2 = urllib.parse.urlunsplit(result) | ||
self.assertEqual(result2, url) | ||
self.assertEqual(result2, result.geturl()) | ||
self.assertSequenceEqual(result2, url) | ||
self.assertSequenceEqual(result2, result.geturl()) | ||
|
||
# check the fixpoint property of re-parsing the result of geturl() | ||
result3 = urllib.parse.urlsplit(result.geturl()) | ||
self.assertEqual(result3.geturl(), result.geturl()) | ||
self.assertEqual(result3, result) | ||
self.assertSequenceEqual(result3, result) | ||
self.assertEqual(result3.scheme, result.scheme) | ||
self.assertEqual(result3.netloc, result.netloc) | ||
self.assertEqual(result3.path, result.path) | ||
|
@@ -162,10 +162,15 @@ def test_roundtrips(self): | |
('svn+ssh', 'svn.zope.org', '/repos/main/ZConfig/trunk/', | ||
'', '')), | ||
('git+ssh://[email protected]/user/project.git', | ||
('git+ssh', '[email protected]','/user/project.git', | ||
'','',''), | ||
('git+ssh', '[email protected]','/user/project.git', | ||
'', '')), | ||
('git+ssh', '[email protected]','/user/project.git', | ||
'','',''), | ||
('git+ssh', '[email protected]','/user/project.git', | ||
'', '')), | ||
('itms-services://?action=download-manifest&url=https://example.com/app', | ||
('itms-services', '', '', '', | ||
'action=download-manifest&url=https://example.com/app', ''), | ||
('itms-services', '', '', | ||
'action=download-manifest&url=https://example.com/app', '')), | ||
] | ||
def _encode(t): | ||
return (t[0].encode('ascii'), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2023-05-08-23-01-59.gh-issue-104139.83Tnt-.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Teach :func:`urllib.parse.unsplit` to retain the ``"//"`` when assembling | ||
``itms-services://?action=generate-bugs`` style `Apple Platform Deployment | ||
<https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web>`_ URLs. |