diff --git a/src/zarr/core/buffer/core.py b/src/zarr/core/buffer/core.py index 041585c51..0c6d966db 100644 --- a/src/zarr/core/buffer/core.py +++ b/src/zarr/core/buffer/core.py @@ -282,9 +282,10 @@ def __add__(self, other: Buffer) -> Self: ... def __eq__(self, other: object) -> bool: - # Note: this was needed to support comparing MemoryStore instances with Buffer values in them - # if/when we stopped putting buffers in memory stores, this can be removed - return isinstance(other, type(self)) and self.to_bytes() == other.to_bytes() + # Another Buffer class can override this to choose a more efficient path + return isinstance(other, Buffer) and np.array_equal( + self.as_numpy_array(), other.as_numpy_array() + ) class NDBuffer: diff --git a/tests/v3/test_array.py b/tests/v3/test_array.py index e6bb3ae88..11be51682 100644 --- a/tests/v3/test_array.py +++ b/tests/v3/test_array.py @@ -4,9 +4,8 @@ import numpy as np import pytest -from zarr.core.array import Array, AsyncArray +from zarr import Array, AsyncArray, Group from zarr.core.common import ZarrFormat -from zarr.core.group import Group from zarr.errors import ContainsArrayError, ContainsGroupError from zarr.store import LocalStore, MemoryStore from zarr.store.common import StorePath