Skip to content

yggdrasil.io.delta.tests

tests

Unittest base class for Delta tests.

Sub-class :class:DeltaTestCase instead of importing yggdrasil.io.delta at module level — it skips cleanly when pyarrow isn't available, and gives every test a fresh empty table directory plus a few convenience constructors.

DeltaTestCase

Bases: ArrowTestCase

:class:ArrowTestCase with Delta convenience helpers.

Adds:

  • :meth:delta_io — return a fresh :class:DeltaFolder over a sub-directory of the per-test :attr:tmp_path.
  • :meth:new_table — convenience for "create a brand-new :class:DeltaFolder and seed it with a pyarrow Table in one call."

table

table(data: dict[str, Any], schema: Any = None) -> 'pa.Table'

Shorthand for pa.table(data, schema=schema).

record_batch

record_batch(data: dict[str, Any], schema: Any = None) -> 'pa.RecordBatch'

Shorthand for pa.record_batch(data, schema=schema).

write_parquet

write_parquet(table: 'pa.Table', path: Path | str) -> Path

Write table to path as Parquet and return the path.

read_parquet

read_parquet(path: Path | str) -> 'pa.Table'

Read a Parquet file as a pa.Table.

write_ipc

write_ipc(table: 'pa.Table', path: Path | str) -> Path

Write table as Arrow IPC (file format) and return the path.

read_ipc

read_ipc(path: Path | str) -> 'pa.Table'

Read an Arrow IPC file as a pa.Table.

assertFrameEqual

assertFrameEqual(
    actual: "pa.Table",
    expected: "pa.Table",
    *,
    check_schema: bool = True,
    check_metadata: bool = False
) -> None

Assert two Arrow tables are equal.

check_metadata=False ignores schema and field metadata, which is the usual "does the data match" check. Set it True for round-trip tests where metadata preservation matters.

assertSchemaEqual

assertSchemaEqual(
    actual: "pa.Table | pa.Schema", expected_fields: list[tuple[str, Any]]
) -> None

Assert a table/schema has exactly the given (name, type) fields.