pytest-regressions plugin for xarray
Project description
A pytest-regressions plugin for identifying regressions in Xarray objects.
Install
pip install xarray-regressions
Usage
If you're unfamiliar with pytest-regressions, check out their documentation first. xarray-regressions registers a compatible test fixture xarray_regression for detecting regressions in the data or metadata of xr.DataArray and xr.Dataset objects.
from xarray_regressions import XarrayRegressionFixture
import xarray as xr
def make_dataarray() -> xr.DataArray:
"""A dummy method that needs to be tested."""
return xr.DataArray(
np.full((2, 4, 3), 1),
dims=["variable", "y", "x"],
coords={
"variable": ["var1", "var2"],
"y": [1, 2, 3, 4],
"x": [1, 2, 3],
},
name="sample_data",
attrs={"foo": "bar"},
)
def test_make_dataarray(xarray_regression: XarrayRegressionFixture):
"""Test that the function always returns an identical xr.DataArray."""
da = make_dataarray()
xarray_regression.check(
da,
check_names=True,
check_attrs=True,
)
Once the test is initialized and the expected result is stored in a NetCDF file, test_make_dataarray will fail if the generated xr.DataArray changes in a future run.
xarray_regression.check uses xr.testing.assert_equal to compare equality of values, dimensions, and coordinates. If atol or rtol are provided, it will use xr.testing.assert_allclose instead. Names and attributes are checked separately. Encodings are not currently checked.
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 xarray_regressions-0.0.1.tar.gz.
File metadata
- Download URL: xarray_regressions-0.0.1.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ee87c23898acad35e2cb9e442d7ca0caa861eb2685b77c8858ccacc46ac2f4
|
|
| MD5 |
c8edef62f010d8ba03e24974614c4479
|
|
| BLAKE2b-256 |
eab7e167695b31944b9005656c13e09025dde8c040afe2c4680ec80986c24212
|
Provenance
The following attestation bundles were made for xarray_regressions-0.0.1.tar.gz:
Publisher:
publish.yaml on aazuspan/xarray-regressions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xarray_regressions-0.0.1.tar.gz -
Subject digest:
a0ee87c23898acad35e2cb9e442d7ca0caa861eb2685b77c8858ccacc46ac2f4 - Sigstore transparency entry: 219367044
- Sigstore integration time:
-
Permalink:
aazuspan/xarray-regressions@c9dfee09a251f1bc7544053a272c25cf3fbff3f7 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/aazuspan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@c9dfee09a251f1bc7544053a272c25cf3fbff3f7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xarray_regressions-0.0.1-py3-none-any.whl.
File metadata
- Download URL: xarray_regressions-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92eb97ae38fb2cd2305a88afd7df14ea4081c96fb2643f7a573124777efb4bcf
|
|
| MD5 |
9658014ba2ec4aafcd7f6b7929211a56
|
|
| BLAKE2b-256 |
5369043fe62f472dca9065fdf0c83f97c57d1f841b3b3ec924bdc2381bbb0154
|
Provenance
The following attestation bundles were made for xarray_regressions-0.0.1-py3-none-any.whl:
Publisher:
publish.yaml on aazuspan/xarray-regressions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xarray_regressions-0.0.1-py3-none-any.whl -
Subject digest:
92eb97ae38fb2cd2305a88afd7df14ea4081c96fb2643f7a573124777efb4bcf - Sigstore transparency entry: 219367048
- Sigstore integration time:
-
Permalink:
aazuspan/xarray-regressions@c9dfee09a251f1bc7544053a272c25cf3fbff3f7 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/aazuspan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@c9dfee09a251f1bc7544053a272c25cf3fbff3f7 -
Trigger Event:
push
-
Statement type: