Scrapy, a fast high-level web crawling & scraping framework for Python.
Link.__eq__: return NotImplemented instead of raising NotImplementedError (#7611)
Adrian983e6c11826f
diff --git a/scrapy/link.py b/scrapy/link.pyindex 9c272ab2f..046630403 100644--- a/scrapy/link.py+++ b/scrapy/link.py@@ -39,7 +39,7 @@ class Link:def __eq__(self, other: object) -> bool:if not isinstance(other, Link):- raise NotImplementedError+ return NotImplementedreturn (self.url == other.urland self.text == other.textdiff --git a/tests/test_link.py b/tests/test_link.pyindex c49e5c090..0eeffe12b 100644--- a/tests/test_link.py+++ b/tests/test_link.py@@ -55,3 +55,7 @@ class TestLink:def test_bytes_url(self):with pytest.raises(TypeError):Link(b"http://www.example.com/\xc2\xa3")++ def test_eq_non_link(self):+ url = "http://example.com"+ assert Link(url) != url