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

Method test_urldefrag

Lib/test/test_urlparse.py:806–820  ·  view source on GitHub ↗
(self, bytes, url, defrag, frag, missing_as_none)

Source from the content-addressed store, hash-verified

804 ])
805 @support.subTests('missing_as_none', (False, True))
806 def test_urldefrag(self, bytes, url, defrag, frag, missing_as_none):
807 if bytes:
808 url = str_encode(url)
809 defrag = str_encode(defrag)
810 frag = str_encode(frag)
811 result = urllib.parse.urldefrag(url, missing_as_none=missing_as_none)
812 if not missing_as_none:
813 hash = '#' if isinstance(url, str) else b'#'
814 url = url.rstrip(hash)
815 if frag is None:
816 frag = url[:0]
817 self.assertEqual(result.geturl(), url)
818 self.assertEqual(result, (defrag, frag))
819 self.assertEqual(result.url, defrag)
820 self.assertEqual(result.fragment, frag)
821
822 def test_urlsplit_scoped_IPv6(self):
823 p = urllib.parse.urlsplit('http://[FE80::822a:a8ff:fe49:470c%tESt]:1234')

Callers

nothing calls this directly

Calls 4

str_encodeFunction · 0.85
rstripMethod · 0.45
assertEqualMethod · 0.45
geturlMethod · 0.45

Tested by

no test coverage detected