Skip to content

Commit

Permalink
Test no-data case too
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Oct 23, 2024
1 parent dcf3cfc commit fe5eb66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fsspec/implementations/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 21 additions & 1 deletion fsspec/implementations/tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fe5eb66

Please sign in to comment.