How to use the serpextract.serpextract._is_url_without_path_query_or_fragment function in serpextract

To help you get started, we’ve selected a few serpextract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Parsely / serpextract / tests / test_helpers.py View on Github external
def test_is_url_without_path_query_or_fragment(self):
        is_url_without_path_query_or_fragment = \
            serpextract._is_url_without_path_query_or_fragment
        results = (
            ('http://www.something.com', True),
            ('http://www.something.com/', True),
            ('http://www.something.com/path', False),
            ('http://www.something.com/?query=true', False),
            ('http://www.something.com/#fragment', False),
            ('http://www.something.com/path?query=True#fragment', False),
        )

        for url, expected in results:
            parts = urlparse(url)
            actual = is_url_without_path_query_or_fragment(parts)
            self.assertEqual(actual, expected)