(self, missing_as_none)
| 1098 | |
| 1099 | @support.subTests('missing_as_none', (False, True)) |
| 1100 | def test_withoutscheme(self, missing_as_none): |
| 1101 | # Test urlparse without scheme |
| 1102 | # Issue 754016: urlparse goes wrong with IP:port without scheme |
| 1103 | # RFC 1808 specifies that netloc should start with //, urlparse expects |
| 1104 | # the same, otherwise it classifies the portion of url as path. |
| 1105 | none = None if missing_as_none else '' |
| 1106 | self.assertEqual(urlparse("path", missing_as_none=missing_as_none), |
| 1107 | (none, none, 'path', none, none, none)) |
| 1108 | self.assertEqual(urlparse("//www.python.org:80", missing_as_none=missing_as_none), |
| 1109 | (none, 'www.python.org:80', '', none, none, none)) |
| 1110 | self.assertEqual(urlparse("http://www.python.org:80", missing_as_none=missing_as_none), |
| 1111 | ('http', 'www.python.org:80', '', none, none, none)) |
| 1112 | # Repeat for bytes input |
| 1113 | none = None if missing_as_none else b'' |
| 1114 | self.assertEqual(urlparse(b"path", missing_as_none=missing_as_none), |
| 1115 | (none, none, b'path', none, none, none)) |
| 1116 | self.assertEqual(urlparse(b"//www.python.org:80", missing_as_none=missing_as_none), |
| 1117 | (none, b'www.python.org:80', b'', none, none, none)) |
| 1118 | self.assertEqual(urlparse(b"http://www.python.org:80", missing_as_none=missing_as_none), |
| 1119 | (b'http', b'www.python.org:80', b'', none, none, none)) |
| 1120 | |
| 1121 | @support.subTests('missing_as_none', (False, True)) |
| 1122 | def test_portseparator(self, missing_as_none): |
nothing calls this directly
no test coverage detected