Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Jul 8, 2024
1 parent 097a491 commit abfdc16
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fsspec/implementations/tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,3 +759,27 @@ def test_append_parquet(lazy_refs, m):
with pytest.raises(KeyError):
lazy2["data/0"]
assert lazy2["data/1"] == b"Adata"


def test_deep_parq(m):
zarr = pytest.importorskip("zarr")
lz = fsspec.implementations.reference.LazyReferenceMapper.create(
"memory://out.parq", fs=m
)
g = zarr.open_group(lz, mode="w")
g2 = g.create_group("instant")
g2.create_dataset(name="one", data=[1, 2, 3])
lz.flush()

lz = fsspec.implementations.reference.LazyReferenceMapper("memory://out.parq", fs=m)
g = zarr.open_group(lz)
assert g.instant.one[:].tolist() == [1, 2, 3]
assert sorted(_["name"] for _ in lz.ls("")) == [".zgroup", ".zmetadata", "instant"]
assert sorted(_["name"] for _ in lz.ls("instant")) == [
"instant/.zgroup",
"instant/one",
]
assert sorted(_["name"] for _ in lz.ls("instant/one")) == [
"instant/one/.zarray",
"instant/one/0",
]

0 comments on commit abfdc16

Please sign in to comment.