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

Method test_attributes_bad_scheme

Lib/test/test_urlparse.py:1040–1048  ·  view source on GitHub ↗

Check handling of invalid schemes.

(self, bytes, parse, scheme)

Source from the content-addressed store, hash-verified

1038 @support.subTests('parse', (urllib.parse.urlsplit, urllib.parse.urlparse))
1039 @support.subTests('scheme', (".", "+", "-", "0", "http&", "६http"))
1040 def test_attributes_bad_scheme(self, bytes, parse, scheme):
1041 """Check handling of invalid schemes."""
1042 url = scheme + "://www.example.net"
1043 if bytes:
1044 if not url.isascii():
1045 self.skipTest('non-ASCII bytes')
1046 url = url.encode("ascii")
1047 p = parse(url, missing_as_none=True)
1048 self.assertIsNone(p.scheme)
1049
1050 @support.subTests('missing_as_none', (False, True))
1051 def test_attributes_without_netloc(self, missing_as_none):

Callers

nothing calls this directly

Calls 5

isasciiMethod · 0.80
skipTestMethod · 0.80
assertIsNoneMethod · 0.80
parseFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected