Skip to content

Commit acf870c

Browse files
authored
BUG: fix equality check on Graph (#809)
1 parent 283286f commit acf870c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

libpysal/graph/_set_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def equals(self, right):
181181
pandas.testing.assert_series_equal(
182182
self._adjacency, right._adjacency, check_dtype=False
183183
)
184-
except AssertionError:
184+
except (AssertionError, AttributeError):
185185
return False
186186
return True
187187

libpysal/graph/tests/test_set_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ def test___gt__(self):
9999
def test___eq__(self):
100100
assert self.distance2500 == self.distance2500.copy()
101101
assert not self.distance2500 == self.distance2500_id # noqa: SIM201
102+
assert not self.distance2500 == None # noqa: E711, SIM201
102103

103104
def test___ne__(self):
104105
assert not self.distance2500 != self.distance2500.copy() # noqa: SIM202
105106
assert self.distance2500 != self.distance2500_id
107+
assert self.distance2500 != None # noqa: E711
106108

107109
def test___and__(self):
108110
result = self.distance2500 & self.knn3

0 commit comments

Comments
 (0)