def test_url_join(self): self.assertEqual( 'http://example.net', urljoin('http://example.com', '//example.net') ) self.assertEqual( 'https://example.net', urljoin('https://example.com', '//example.net') ) self.assertEqual( 'https://example.com/asdf', urljoin('https://example.com/cookies', '/asdf') ) self.assertEqual( 'http://example.com/asdf', urljoin('http://example.com/cookies', 'asdf') ) self.assertEqual( 'http://example.com/cookies/asdf', urljoin('http://example.com/cookies/', 'asdf') ) self.assertEqual( 'https://example.net/asdf', urljoin('https://example.net/', '/asdf') ) self.assertEqual( 'http://example.net/asdf', urljoin('https://example.com', 'http://example.net/asdf') ) self.assertEqual( 'http://example.com/', urljoin('http://example.com', '//example.com/') )
def test_url_join(self): self.assertEqual('http://example.net', urljoin('http://example.com', '//example.net')) self.assertEqual('https://example.net', urljoin('https://example.com', '//example.net')) self.assertEqual('https://example.com/asdf', urljoin('https://example.com/cookies', '/asdf')) self.assertEqual('http://example.com/asdf', urljoin('http://example.com/cookies', 'asdf')) self.assertEqual('http://example.com/cookies/asdf', urljoin('http://example.com/cookies/', 'asdf')) self.assertEqual('https://example.net/asdf', urljoin('https://example.net/', '/asdf')) self.assertEqual( 'http://example.net/asdf', urljoin('https://example.com', 'http://example.net/asdf')) self.assertEqual('http://example.com/', urljoin('http://example.com', '//example.com/')) self.assertEqual('http://example.com/a/style.css', urljoin('http://example.com/a/', './style.css')) self.assertEqual('http://example.com/style.css', urljoin('http://example.com/a/', './../style.css'))
def test_url_join(self): self.assertEqual('http://example.net', urljoin('http://example.com', '//example.net')) self.assertEqual('https://example.net', urljoin('https://example.com', '//example.net')) self.assertEqual('http://example.net', urljoin('http://example.com/', '//example.net')) self.assertEqual('https://example.net', urljoin('https://example.com/', '//example.net')) self.assertEqual('http://example.net/', urljoin('http://example.com/', '//example.net/')) self.assertEqual('https://example.net/', urljoin('https://example.com/', '//example.net/')) self.assertEqual('https://example.com/asdf', urljoin('https://example.com/cookies', '/asdf')) self.assertEqual('http://example.com/asdf', urljoin('http://example.com/cookies', 'asdf')) self.assertEqual('http://example.com/cookies/asdf', urljoin('http://example.com/cookies/', 'asdf')) self.assertEqual('https://example.net/asdf', urljoin('https://example.net/', '/asdf')) self.assertEqual( 'http://example.net/asdf', urljoin('https://example.com', 'http://example.net/asdf')) self.assertEqual('http://example.com/', urljoin('http://example.com', '//example.com/')) self.assertEqual('http://example.com/', urljoin('http://example.com/', '//')) self.assertEqual('http://example.com/', urljoin('http://example.com/', '///')) self.assertEqual('http://example.com/a/style.css', urljoin('http://example.com/a/', './style.css')) self.assertEqual('http://example.com/style.css', urljoin('http://example.com/a/', './../style.css')) self.assertEqual('sausage', urljoin('mailto:hotdogbun', 'sausage')) self.assertEqual('mailto://sausage', urljoin('mailto:hotdogbun', '//sausage')) self.assertEqual('hotdogbun://sausage', urljoin('hotdogbun', '//sausage'))
def test_url_join(self): self.assertEqual( 'http://example.net', urljoin('http://example.com', '//example.net') ) self.assertEqual( 'https://example.net', urljoin('https://example.com', '//example.net') ) self.assertEqual( 'http://example.net', urljoin('http://example.com/', '//example.net') ) self.assertEqual( 'https://example.net', urljoin('https://example.com/', '//example.net') ) self.assertEqual( 'http://example.net/', urljoin('http://example.com/', '//example.net/') ) self.assertEqual( 'https://example.net/', urljoin('https://example.com/', '//example.net/') ) self.assertEqual( 'https://example.com/asdf', urljoin('https://example.com/cookies', '/asdf') ) self.assertEqual( 'http://example.com/asdf', urljoin('http://example.com/cookies', 'asdf') ) self.assertEqual( 'http://example.com/cookies/asdf', urljoin('http://example.com/cookies/', 'asdf') ) self.assertEqual( 'https://example.net/asdf', urljoin('https://example.net/', '/asdf') ) self.assertEqual( 'http://example.net/asdf', urljoin('https://example.com', 'http://example.net/asdf') ) self.assertEqual( 'http://example.com/', urljoin('http://example.com', '//example.com/') ) self.assertEqual( 'http://example.com/', urljoin('http://example.com/', '//') ) self.assertEqual( 'http://example.com/', urljoin('http://example.com/', '///') ) self.assertEqual( 'http://example.com/a/style.css', urljoin('http://example.com/a/', './style.css') ) self.assertEqual( 'http://example.com/style.css', urljoin('http://example.com/a/', './../style.css') ) self.assertEqual( 'sausage', urljoin('mailto:hotdogbun', 'sausage') ) self.assertEqual( 'mailto://sausage', urljoin('mailto:hotdogbun', '//sausage') ) self.assertEqual( 'hotdogbun://sausage', urljoin('hotdogbun', '//sausage') )