MCPcopy Create free account
hub / github.com/apache/arrow / test_fragments_repr

Function test_fragments_repr

python/pyarrow/tests/test_dataset.py:1936–1968  ·  view source on GitHub ↗
(tempdir, dataset)

Source from the content-addressed store, hash-verified

1934@pytest.mark.pandas
1935@pytest.mark.parquet
1936def test_fragments_repr(tempdir, dataset):
1937 # partitioned parquet dataset
1938 fragment = list(dataset.get_fragments())[0]
1939 assert (
1940 # Ordering of partition items is non-deterministic
1941 repr(fragment) ==
1942 "<pyarrow.dataset.ParquetFileFragment path=subdir/1/xxx/file0.parquet "
1943 "partition=[key=xxx, group=1]>" or
1944 repr(fragment) ==
1945 "<pyarrow.dataset.ParquetFileFragment path=subdir/1/xxx/file0.parquet "
1946 "partition=[group=1, key=xxx]>"
1947 )
1948
1949 # single-file parquet dataset (no partition information in repr)
1950 table, path = _create_single_file(tempdir)
1951 dataset = ds.dataset(path, format="parquet")
1952 fragment = list(dataset.get_fragments())[0]
1953 assert (
1954 repr(fragment) ==
1955 "<pyarrow.dataset.ParquetFileFragment path="
1956 f"{dataset.filesystem.normalize_path(str(path))}>"
1957 )
1958
1959 # non-parquet format
1960 path = tempdir / "data.feather"
1961 pa.feather.write_feather(table, path)
1962 dataset = ds.dataset(path, format="feather")
1963 fragment = list(dataset.get_fragments())[0]
1964 assert (
1965 repr(fragment) ==
1966 "<pyarrow.dataset.FileFragment type=ipc path="
1967 f"{dataset.filesystem.normalize_path(str(path))}>"
1968 )
1969
1970
1971@pytest.mark.parquet

Callers

nothing calls this directly

Calls 3

listFunction · 0.85
_create_single_fileFunction · 0.85
normalize_pathMethod · 0.45

Tested by

no test coverage detected