Beispiel #1
0
def test_normalize():
    assert(
        url.normalize('http://www.naver.com/a//b///c') ==
        'http://www.naver.com/a/b/c'
    )
    assert(
        url.normalize('http://www.naver.com///') ==
        'http://www.naver.com'
    )
Beispiel #2
0
def test_fillurl(index, relpath, abspath):
    assert(
        url.fillurl(index, relpath) ==
        url.normalize(index + '/' + relpath)
    )
    parsedi = urlparse(index)
    parsedu = urlparse(abspath)
    assert(
        url.fillurl(index, abspath) ==
        url.normalize(
            '%s://%s/%s%s' % (
                parsedi.scheme, parsedi.hostname, parsedu.path.lstrip('/'),
                '?' + parsedu.query if parsedu.query else ''
            )
        )
    )