Check handling of invalid ports.
(self, bytes, parse, port)
| 1021 | @support.subTests('parse', (urllib.parse.urlsplit, urllib.parse.urlparse)) |
| 1022 | @support.subTests('port', ("foo", "1.5", "-1", "0x10", "-0", "1_1", " 1", "1 ", "६")) |
| 1023 | def test_attributes_bad_port(self, bytes, parse, port): |
| 1024 | """Check handling of invalid ports.""" |
| 1025 | netloc = "www.example.net:" + port |
| 1026 | url = "http://" + netloc + "/" |
| 1027 | if bytes: |
| 1028 | if not (netloc.isascii() and port.isascii()): |
| 1029 | self.skipTest('non-ASCII bytes') |
| 1030 | netloc = str_encode(netloc) |
| 1031 | url = str_encode(url) |
| 1032 | p = parse(url) |
| 1033 | self.assertEqual(p.netloc, netloc) |
| 1034 | with self.assertRaises(ValueError): |
| 1035 | p.port |
| 1036 | |
| 1037 | @support.subTests('bytes', (False, True)) |
| 1038 | @support.subTests('parse', (urllib.parse.urlsplit, urllib.parse.urlparse)) |
nothing calls this directly
no test coverage detected