示例#1
0
    def test_urljoin(self):
        for base, args, expected in [
            ("http://localhost", ["path1"], "http://localhost/path1"),
            ("http://localhost/path1", ["path2"], "http://localhost/path1/path2"),
            ("http://localhost", ["path1", "path2"], "http://localhost/path1/path2"),
            ("http://localhost?foo=bar", ["path1"], "http://localhost/path1?foo=bar"),
        ]:

            assert urljoin(base, *args) == expected
示例#2
0
def test_urljoin():
    data = [
        ('http://localhost', ['path1'], 'http://localhost/path1'),
        ('http://localhost/path1', ['path2'], 'http://localhost/path1/path2'),
        ('http://localhost', ['path1', 'path2'], 'http://localhost/path1/path2'),
        ('http://localhost?foo=bar', ['path1'], 'http://localhost/path1?foo=bar'),
    ]

    for base, args, expected in data:
        assert urljoin(base, *args) == expected
示例#3
0
def test_urljoin():
    data = [
        ('http://localhost', ['path1'], 'http://localhost/path1'),
        ('http://localhost/path1', ['path2'], 'http://localhost/path1/path2'),
        ('http://localhost', ['path1',
                              'path2'], 'http://localhost/path1/path2'),
        ('http://localhost?foo=bar', ['path1'],
         'http://localhost/path1?foo=bar'),
    ]

    for base, args, expected in data:
        assert urljoin(base, *args) == expected
示例#4
0
    def test_urljoin(self):
        for base, args, expected in [
            ('http://localhost', ['path1'],
             'http://localhost/path1'),

            ('http://localhost/path1', ['path2'],
             'http://localhost/path1/path2'),

            ('http://localhost', ['path1', 'path2'],
             'http://localhost/path1/path2'),

            ('http://localhost?foo=bar', ['path1'],
             'http://localhost/path1?foo=bar'),
            ]:

            eq_(urljoin(base, *args), expected)