From fe5eb66f92f68705b9bccccf00197ca3f253a12f Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Wed, 23 Oct 2024 11:04:34 -0400 Subject: [PATCH] Test no-data case too --- fsspec/implementations/memory.py | 2 ++ .../implementations/tests/test_reference.py | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/fsspec/implementations/memory.py b/fsspec/implementations/memory.py index 93860af6a..d06db4c38 100644 --- a/fsspec/implementations/memory.py +++ b/fsspec/implementations/memory.py @@ -220,6 +220,8 @@ def cp_file(self, path1, path2, **kwargs): raise FileNotFoundError(path1) def cat_file(self, path, start=None, end=None, **kwargs): + if "refs.0.parq" in path: + breakpoint() logger.debug("cat: %s", path) path = self._strip_protocol(path) try: diff --git a/fsspec/implementations/tests/test_reference.py b/fsspec/implementations/tests/test_reference.py index 8c4aafa6a..09c55d41c 100644 --- a/fsspec/implementations/tests/test_reference.py +++ b/fsspec/implementations/tests/test_reference.py @@ -802,5 +802,25 @@ def test_parquet_no_data(m): ) lz.flush() - breakpoint() assert (arr[:] == 1).all() + + +def test_parquet_no_references(m): + zarr = pytest.importorskip("zarr") + lz = fsspec.implementations.reference.LazyReferenceMapper.create( + "memory://out.parq", fs=m + ) + + g = zarr.open_group(lz, mode="w") + arr = g.create_dataset( + name="one", + dtype="int32", + shape=(), + chunks=(), + compression=None, + fill_value=1, + ) + lz.flush() + arr[...] + + assert arr[...].tolist() == 1 # scalar, equal to fill value