MCPcopy Index your code
hub / github.com/python/cpython / test_portseparator

Method test_portseparator

Lib/test/test_urlparse.py:1122–1150  ·  view source on GitHub ↗
(self, missing_as_none)

Source from the content-addressed store, hash-verified

1120
1121 @support.subTests('missing_as_none', (False, True))
1122 def test_portseparator(self, missing_as_none):
1123 # Issue 754016 makes changes for port separator ':' from scheme separator
1124 none = None if missing_as_none else ''
1125 self.assertEqual(urlparse("http:80", missing_as_none=missing_as_none),
1126 ('http', none, '80', none, none, none))
1127 self.assertEqual(urlparse("https:80", missing_as_none=missing_as_none),
1128 ('https', none, '80', none, none, none))
1129 self.assertEqual(urlparse("path:80", missing_as_none=missing_as_none),
1130 ('path', none, '80', none, none, none))
1131 self.assertEqual(urlparse("http:", missing_as_none=missing_as_none),
1132 ('http', none, '', none, none, none))
1133 self.assertEqual(urlparse("https:", missing_as_none=missing_as_none),
1134 ('https', none, '', none, none, none))
1135 self.assertEqual(urlparse("http://www.python.org:80", missing_as_none=missing_as_none),
1136 ('http', 'www.python.org:80', '', none, none, none))
1137 # As usual, need to check bytes input as well
1138 none = None if missing_as_none else b''
1139 self.assertEqual(urlparse(b"http:80", missing_as_none=missing_as_none),
1140 (b'http', none, b'80', none, none, none))
1141 self.assertEqual(urlparse(b"https:80", missing_as_none=missing_as_none),
1142 (b'https', none, b'80', none, none, none))
1143 self.assertEqual(urlparse(b"path:80", missing_as_none=missing_as_none),
1144 (b'path', none, b'80', none, none, none))
1145 self.assertEqual(urlparse(b"http:", missing_as_none=missing_as_none),
1146 (b'http', none, b'', none, none, none))
1147 self.assertEqual(urlparse(b"https:", missing_as_none=missing_as_none),
1148 (b'https', none, b'', none, none, none))
1149 self.assertEqual(urlparse(b"http://www.python.org:80", missing_as_none=missing_as_none),
1150 (b'http', b'www.python.org:80', b'', none, none, none))
1151
1152 def test_usingsys(self):
1153 # Issue 3314: sys module is used in the error

Callers

nothing calls this directly

Calls 2

urlparseFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected