Python werkzeug.urls.url_join() Examples

The following are 2 code examples of werkzeug.urls.url_join(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module werkzeug.urls , or try the search function .
Example #1
Source File: urls.py    From Flask with Apache License 2.0 5 votes vote down vote up
def test_url_joining(self):
        self.assert_strict_equal(urls.url_join('/foo', '/bar'), '/bar')
        self.assert_strict_equal(urls.url_join('http://example.com/foo', '/bar'),
                                 'http://example.com/bar')
        self.assert_strict_equal(urls.url_join('file:///tmp/', 'test.html'),
                                 'file:///tmp/test.html')
        self.assert_strict_equal(urls.url_join('file:///tmp/x', 'test.html'),
                                 'file:///tmp/test.html')
        self.assert_strict_equal(urls.url_join('file:///tmp/x', '../../../x.html'),
                                 'file:///x.html') 
Example #2
Source File: urls.py    From Flask with Apache License 2.0 5 votes vote down vote up
def test_url_joining(self):
        self.assert_strict_equal(urls.url_join('/foo', '/bar'), '/bar')
        self.assert_strict_equal(urls.url_join('http://example.com/foo', '/bar'),
                                 'http://example.com/bar')
        self.assert_strict_equal(urls.url_join('file:///tmp/', 'test.html'),
                                 'file:///tmp/test.html')
        self.assert_strict_equal(urls.url_join('file:///tmp/x', 'test.html'),
                                 'file:///tmp/test.html')
        self.assert_strict_equal(urls.url_join('file:///tmp/x', '../../../x.html'),
                                 'file:///x.html')