MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_splithost

Method test_splithost

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

Source from the content-addressed store, hash-verified

1538 self.assertEqual(splittype('type:opaque:string'), ('type', 'opaque:string'))
1539
1540 def test_splithost(self):
1541 splithost = urllib.parse._splithost
1542 self.assertEqual(splithost('//www.example.org:80/foo/bar/baz.html'),
1543 ('www.example.org:80', '/foo/bar/baz.html'))
1544 self.assertEqual(splithost('//www.example.org:80'),
1545 ('www.example.org:80', ''))
1546 self.assertEqual(splithost('/foo/bar/baz.html'),
1547 (None, '/foo/bar/baz.html'))
1548
1549 # bpo-30500: # starts a fragment.
1550 self.assertEqual(splithost('//127.0.0.1#@host.com'),
1551 ('127.0.0.1', '/#@host.com'))
1552 self.assertEqual(splithost('//127.0.0.1#@host.com:80'),
1553 ('127.0.0.1', '/#@host.com:80'))
1554 self.assertEqual(splithost('//127.0.0.1:80#@host.com'),
1555 ('127.0.0.1:80', '/#@host.com'))
1556
1557 # Empty host is returned as empty string.
1558 self.assertEqual(splithost("///file"),
1559 ('', '/file'))
1560
1561 # Trailing semicolon, question mark and hash symbol are kept.
1562 self.assertEqual(splithost("//example.net/file;"),
1563 ('example.net', '/file;'))
1564 self.assertEqual(splithost("//example.net/file?"),
1565 ('example.net', '/file?'))
1566 self.assertEqual(splithost("//example.net/file#"),
1567 ('example.net', '/file#'))
1568
1569 def test_splituser(self):
1570 splituser = urllib.parse._splituser

Callers

nothing calls this directly

Calls 2

splithostFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected