diff --git a/pottery/list.py b/pottery/list.py index 44743196..64467f45 100644 --- a/pottery/list.py +++ b/pottery/list.py @@ -209,7 +209,7 @@ def __eq__(self, other: Any) -> bool: if len(self) != len(other): # self and other are different lengths. return False - elif isinstance(other, collections.abc.Sequence): + elif isinstance(other, collections.abc.MutableSequence): # self and other are the same length, and other is an # ordered collection too. Compare self's and other's # elements, pair by pair. diff --git a/pottery/nextid.py b/pottery/nextid.py index 0de6d34e..3d94941b 100644 --- a/pottery/nextid.py +++ b/pottery/nextid.py @@ -191,6 +191,7 @@ def __current_id(self, value: int) -> None: else: if num_masters_set > len(self.masters) // 2: # pragma: no cover return + raise QuorumNotAchieved(self.key, self.masters) diff --git a/tests/test_list.py b/tests/test_list.py index b14f358c..74f9742a 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -172,13 +172,13 @@ def test_eq_same_redis_instance_different_keys(self): def test_eq_different_lengths(self): squares1 = RedisList((1, 4, 9, 16, 25), redis=self.redis) - squares2 = (1, 4, 9, 16, 25, 36) + squares2 = [1, 4, 9, 16, 25, 36] assert not squares1 == squares2 assert squares1 != squares2 def test_eq_different_items(self): squares1 = RedisList((1, 4, 9, 16, 25), redis=self.redis) - squares2 = (4, 9, 16, 25, 36) + squares2 = [4, 9, 16, 25, 36] assert not squares1 == squares2 assert squares1 != squares2 @@ -193,6 +193,12 @@ def test_eq_typeerror(self): assert not squares == None assert squares != None + def test_eq_tuple(self): + squares = RedisList((1, 4, 9, 16, 25), redis=self.redis) + assert squares == [1, 4, 9, 16, 25] + assert not squares == (1, 4, 9, 16, 25) + assert squares != (1, 4, 9, 16, 25) + def test_repr(self): squares = RedisList((1, 4, 9, 16, 25), redis=self.redis) assert repr(squares) == 'RedisList[1, 4, 9, 16, 25]'