pytest-ditto plugin for pyarrow table snapshots.
Project description
pytest-ditto-pyarrow
Extension plugin for pytest-ditto for pyarrow table snapshots.
Use the following marks for their associated recorder:
@ditto.pyarrow.parquet@ditto.pyarrow.feather@ditto.pyarrow.csv
Installation
pip install pytest-ditto[pyarrow]
Usage
The following test example tests the result of fn hasn't changed by comparing against a saved snapshot of the result. This snapshot is taken the first time the test is run; hence, the initial run is not a proper test run. Subsequent test runs are compared against the saved result.
- The fixture,
tableis apyarrow.Tableand is the argument to the function under test,fn. fntransforms the data and the test asserts the result of this function in unchanged compared to the initial, hopefully validated, result.- The output format of the snapshot is parquet as defined by the
@ditto.pyarrow.parquetmark.
import pyarrow as pa
import pyarrow.compute as pc
import ditto
import pytest
@pytest.fixture
def table() -> pa.Table:
return pa.table(
[
[1, 2, 3, 4],
[4.5, 5.2, 6.8, 3.5],
[7, 8.5, None, None],
[True, False, True, True],
["a", "b", "c", "x"],
],
names=list("abcde"),
)
def fn(x: pa.Table):
even_filter = (pc.bit_wise_and(pc.field("a"), pc.scalar(1)) == pc.scalar(0))
return x.filter(even_filter)
@ditto.pyarrow.parquet
def test_fn_with_pyarrow_parquet_snapshot(snapshot, table):
result = fn(table)
assert result.equals(snapshot(result, key="filtered"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_ditto_pyarrow-0.1.0.tar.gz.
File metadata
- Download URL: pytest_ditto_pyarrow-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f9465a6ba05f028a906ddfb2f2f47dbad74fd879b0d6cb301c847c0b8e138f3
|
|
| MD5 |
cb8b574d29a49cc00b1215943693afb3
|
|
| BLAKE2b-256 |
ea4e89f48b9d4f0615c9b759a2ccec4626f2de914e655544e0e5ea1bd89e6768
|
Provenance
The following attestation bundles were made for pytest_ditto_pyarrow-0.1.0.tar.gz:
Publisher:
release.yml on owlowlyowl/pytest-ditto-pyarrow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_ditto_pyarrow-0.1.0.tar.gz -
Subject digest:
0f9465a6ba05f028a906ddfb2f2f47dbad74fd879b0d6cb301c847c0b8e138f3 - Sigstore transparency entry: 1154876478
- Sigstore integration time:
-
Permalink:
owlowlyowl/pytest-ditto-pyarrow@31323ee58952d3e1191a89e43e763433f25b0566 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/owlowlyowl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31323ee58952d3e1191a89e43e763433f25b0566 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_ditto_pyarrow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_ditto_pyarrow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d4a27fc1c6b36a98e3181c68ed07e284f10f2ed280576aa810511f1dbe006f1
|
|
| MD5 |
a8cc70bc7c5894ab50b8cfb889387be7
|
|
| BLAKE2b-256 |
ed89d3a8cd09873dd57ae90d0751db4f742e94e997464f4f01ef70c94ef81bae
|
Provenance
The following attestation bundles were made for pytest_ditto_pyarrow-0.1.0-py3-none-any.whl:
Publisher:
release.yml on owlowlyowl/pytest-ditto-pyarrow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_ditto_pyarrow-0.1.0-py3-none-any.whl -
Subject digest:
4d4a27fc1c6b36a98e3181c68ed07e284f10f2ed280576aa810511f1dbe006f1 - Sigstore transparency entry: 1154876481
- Sigstore integration time:
-
Permalink:
owlowlyowl/pytest-ditto-pyarrow@31323ee58952d3e1191a89e43e763433f25b0566 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/owlowlyowl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31323ee58952d3e1191a89e43e763433f25b0566 -
Trigger Event:
release
-
Statement type: