Skip to content

Commit eab037d

Browse files
author
Nick Manganelli
committed
test for parquet uuid
1 parent 667de50 commit eab037d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
2+
3+
from __future__ import annotations
4+
5+
import pathlib
6+
7+
import pytest
8+
9+
import awkward
10+
11+
metadata_from_parquet_submodule = pytest.importorskip(
12+
"awkward.operations.ak_metadata_from_parquet"
13+
)
14+
metadata_from_parquet = metadata_from_parquet_submodule.metadata_from_parquet
15+
16+
SAMPLES_DIR = pathlib.Path(__file__).parent / "samples"
17+
input = SAMPLES_DIR / "nullable-record-primitives.parquet"
18+
19+
20+
def test_parquet_uuid():
21+
meta = metadata_from_parquet(input)
22+
assert (
23+
meta["uuid"]
24+
== "93fd596534251b1ac750f359d9d55418b02bcddcc79cd5ab1e3d9735941fbcae"
25+
)
26+
27+
28+
@pytest.mark.parametrize("calculate_uuid", [True, False])
29+
def test_return_tuple_with_or_without_uuid(calculate_uuid):
30+
results = awkward.operations.ak_from_parquet.metadata(
31+
input,
32+
{},
33+
None,
34+
None,
35+
False,
36+
True,
37+
calculate_uuid=calculate_uuid,
38+
)
39+
if calculate_uuid:
40+
assert len(results) == 8, "Expected 8 items in the result tuple"
41+
(
42+
parquet_columns,
43+
subform,
44+
actual_paths,
45+
fs,
46+
subrg,
47+
col_counts,
48+
metadata,
49+
uuid,
50+
) = results
51+
assert uuid is not None, "UUID should be present when calculate_uuid is True"
52+
else:
53+
assert len(results) == 7, "Expected 7 items in the result tuple"
54+
parquet_columns, subform, actual_paths, fs, subrg, col_counts, metadata = (
55+
results
56+
)

0 commit comments

Comments
 (0)