diff --git a/qutebrowser/test/utils/test_url.py b/qutebrowser/test/utils/test_url.py index e1f16183e..fb8995146 100644 --- a/qutebrowser/test/utils/test_url.py +++ b/qutebrowser/test/utils/test_url.py @@ -24,6 +24,8 @@ import unittest from unittest import TestCase +from PyQt5.QtCore import QUrl + import qutebrowser.utils.url as urlutils @@ -85,12 +87,14 @@ class SpecialURLTests(TestCase): def test_special_urls(self): """Test special URLs.""" for url in self.SPECIAL_URLS: - self.assertTrue(urlutils.is_special_url(url)) + u = QUrl(url) + self.assertTrue(urlutils.is_special_url(u)) def test_normal_urls(self): """Test non-special URLs.""" for url in self.NORMAL_URLS: - self.assertFalse(urlutils.is_special_url(url)) + u = QUrl(url) + self.assertFalse(urlutils.is_special_url(u)) class SearchUrlTests(TestCase): diff --git a/qutebrowser/utils/url.py b/qutebrowser/utils/url.py index 880db5c85..7a95cf2bc 100644 --- a/qutebrowser/utils/url.py +++ b/qutebrowser/utils/url.py @@ -131,9 +131,13 @@ def fuzzy_url(urlstr): def is_special_url(url): - """Return True if url is an about:... or other special URL.""" + """Return True if url is an about:... or other special URL. + + Args: + url: The URL as QUrl. + """ special_schemes = ('about', 'qute', 'file') - return QUrl(url).scheme() in special_schemes + return url.scheme() in special_schemes def is_url(urlstr):