コード例 #1
0
    def test_canonical_url(self):
        data = (
            ('http://www.nexb.com', 'http://www.nexb.com/'),
            ('http://www.nexb.com/#12', 'http://www.nexb.com/#12'),
            ('http://www.nexb.com/a/b/../../c/', 'http://www.nexb.com/c/'),
            ('http://www.nexb.com:80', 'http://www.nexb.com/'),
            ('https://www.nexb.com:443', 'https://www.nexb.com/'),
            ('http://www.nexb.com:443', 'http://www.nexb.com:443/'),
            ('https://www.nexb.com:80', 'https://www.nexb.com:80/'),
            ('http://www.nexb.com/A 0.0.1 Alpha/a_0_0_1.zip',
             'http://www.nexb.com/A%200.0.1%20Alpha/a_0_0_1.zip'),
        )

        for test, expected in data:
            assert expected == finder.canonical_url(test)
コード例 #2
0
    def test_canonical_url(self):
        data = (
            ('http://www.nexb.com', 'http://www.nexb.com/'),
            ('http://www.nexb.com/#12', 'http://www.nexb.com/#12'),
            ('http://www.nexb.com/a/b/../../c/', 'http://www.nexb.com/c/'),
            ('http://www.nexb.com:80', 'http://www.nexb.com/'),
            ('https://www.nexb.com:443', 'https://www.nexb.com/'),
            ('http://www.nexb.com:443', 'http://www.nexb.com:443/'),
            ('https://www.nexb.com:80', 'https://www.nexb.com:80/'),
            ('http://www.nexb.com/A 0.0.1 Alpha/a_0_0_1.zip',
             'http://www.nexb.com/A%200.0.1%20Alpha/a_0_0_1.zip'),
        )

        for test, expected in data:
            assert expected == finder.canonical_url(test)