예제 #1
0
 def test_schemes_simialar(self):
     self.assertTrue(schemes_similar('http', 'http'))
     self.assertTrue(schemes_similar('https', 'http'))
     self.assertTrue(schemes_similar('http', 'https'))
     self.assertTrue(schemes_similar('https', 'https'))
     self.assertFalse(schemes_similar('ftp', 'http'))
     self.assertTrue(schemes_similar('email', 'email'))
예제 #2
0
파일: url_test.py 프로젝트: d235j/wpull
 def test_schemes_simialar(self):
     self.assertTrue(schemes_similar('http', 'http'))
     self.assertTrue(schemes_similar('https', 'http'))
     self.assertTrue(schemes_similar('http', 'https'))
     self.assertTrue(schemes_similar('https', 'https'))
     self.assertFalse(schemes_similar('ftp', 'http'))
     self.assertTrue(schemes_similar('email', 'email'))
예제 #3
0
    def test(self, url_info, url_table_record):
        if url_table_record.inline_level:
            return True

        if url_table_record.root_url:
            top_url_info = URLInfo.parse(url_table_record.root_url)
        else:
            top_url_info = url_info

        if schemes_similar(url_info.scheme, top_url_info.scheme) \
           and url_info.hostname == top_url_info.hostname \
           and (
               url_info.scheme != top_url_info.scheme or
               url_info.port == top_url_info.port
        ):
            return is_subdir(top_url_info.path, url_info.path,
                             trailing_slash=True)

        return True