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

Method test_splithost

Lib/test/test_urlparse.py:1772–1799  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1770 self.assertEqual(splittype('type:opaque:string'), ('type', 'opaque:string'))
1771
1772 def test_splithost(self):
1773 splithost = urllib.parse._splithost
1774 self.assertEqual(splithost('//www.example.org:80/foo/bar/baz.html'),
1775 ('www.example.org:80', '/foo/bar/baz.html'))
1776 self.assertEqual(splithost('//www.example.org:80'),
1777 ('www.example.org:80', ''))
1778 self.assertEqual(splithost('/foo/bar/baz.html'),
1779 (None, '/foo/bar/baz.html'))
1780
1781 # bpo-30500: # starts a fragment.
1782 self.assertEqual(splithost('//127.0.0.1#@host.com'),
1783 ('127.0.0.1', '/#@host.com'))
1784 self.assertEqual(splithost('//127.0.0.1#@host.com:80'),
1785 ('127.0.0.1', '/#@host.com:80'))
1786 self.assertEqual(splithost('//127.0.0.1:80#@host.com'),
1787 ('127.0.0.1:80', '/#@host.com'))
1788
1789 # Empty host is returned as empty string.
1790 self.assertEqual(splithost("///file"),
1791 ('', '/file'))
1792
1793 # Trailing semicolon, question mark and hash symbol are kept.
1794 self.assertEqual(splithost("//example.net/file;"),
1795 ('example.net', '/file;'))
1796 self.assertEqual(splithost("//example.net/file?"),
1797 ('example.net', '/file?'))
1798 self.assertEqual(splithost("//example.net/file#"),
1799 ('example.net', '/file#'))
1800
1801 def test_splituser(self):
1802 splituser = urllib.parse._splituser

Callers

nothing calls this directly

Calls 2

splithostFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected