diff --git a/libpysal/graph/_set_ops.py b/libpysal/graph/_set_ops.py index be0cd80f4..71b51ff04 100644 --- a/libpysal/graph/_set_ops.py +++ b/libpysal/graph/_set_ops.py @@ -181,7 +181,7 @@ def equals(self, right): pandas.testing.assert_series_equal( self._adjacency, right._adjacency, check_dtype=False ) - except AssertionError: + except (AssertionError, AttributeError): return False return True diff --git a/libpysal/graph/tests/test_set_ops.py b/libpysal/graph/tests/test_set_ops.py index 626969fd8..47e462562 100644 --- a/libpysal/graph/tests/test_set_ops.py +++ b/libpysal/graph/tests/test_set_ops.py @@ -99,10 +99,12 @@ def test___gt__(self): def test___eq__(self): assert self.distance2500 == self.distance2500.copy() assert not self.distance2500 == self.distance2500_id # noqa: SIM201 + assert not self.distance2500 == None # noqa: E711, SIM201 def test___ne__(self): assert not self.distance2500 != self.distance2500.copy() # noqa: SIM202 assert self.distance2500 != self.distance2500_id + assert self.distance2500 != None # noqa: E711 def test___and__(self): result = self.distance2500 & self.knn3