Fix is_special_url (use QUrl).
This commit is contained in:
parent
7de637baea
commit
9a33efdb3f
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user