urlmatch: Fix equality with non-UrlPattern types
This commit is contained in:
parent
685e3ffcfe
commit
63c77a4d76
@ -104,6 +104,8 @@ class UrlPattern:
|
||||
return hash(self._to_tuple())
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, UrlPattern):
|
||||
return NotImplemented
|
||||
# pylint: disable=protected-access
|
||||
return self._to_tuple() == other._to_tuple()
|
||||
|
||||
|
@ -519,6 +519,10 @@ def test_equal(text1, text2, equal):
|
||||
assert (hash(pat1) == hash(pat2)) == equal
|
||||
|
||||
|
||||
def test_equal_string():
|
||||
assert urlmatch.UrlPattern("<all_urls>") != '<all_urls>'
|
||||
|
||||
|
||||
def test_repr():
|
||||
pat = urlmatch.UrlPattern('https://www.example.com/')
|
||||
expected = ("qutebrowser.utils.urlmatch.UrlPattern("
|
||||
|
Loading…
Reference in New Issue
Block a user