Skip to main content

ci Docs pypi version Python Versions PyPI - Downloads coverage GitHub Sponsors

Installation

pip install inline-snapshot-pandas

Usage

This packages provides special assert_(frame|series|index)_equal implementation which accept a snapshot as second argument.

from pandas import DataFrame
from inline_snapshot_pandas import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2]})

    assert_frame_equal(df, snapshot())
pytest --inline-snapshot=create
from pandas import DataFrame
from inline_snapshot_pandas import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2]})

    assert_frame_equal(
        df,
        snapshot(DataFrame([{"col0": 1}, {"col0": 2}])),
    )

Another way to use it is to call setup() in conftest.py, which replaces the implementation which pandas uses.

from inline_snapshot_pandas import setup

setup()

You can then use implementation from pandas with snapshots.

from pandas import DataFrame
from pandas.testing import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2], "col1": [1, 5j], "col3": ["a", "b"]})

    # the second argument can be a snapshot
    assert_frame_equal(
        df,
        snapshot(
            DataFrame(
                [
                    {"col0": 1, "col1": (1 + 0j), "col3": "a"},
                    {"col0": 2, "col1": 5j, "col3": "b"},
                ]
            )
        ),
    )

Issues

If you encounter any problems, please report an issue along with a detailed description.

License

Distributed under the terms of the MIT license, "inline-snapshot-pandas" is free and open source software.

Metadata

Release files for inline-snapshot-pandas 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inline-snapshot-pandas 0.2.0
File Size Uploaded
inline_snapshot_pandas-0.2.0.tar.gz 118.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inline-snapshot-pandas 0.2.0
File Interpreter ABI Platform
inline_snapshot_pandas-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 122.6 kB

Release files / inline_snapshot_pandas-0.2.0.tar.gz

Download URL inline_snapshot_pandas-0.2.0.tar.gz
Size 118.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d782316c885961be356f3d378b2e9c7da25c6814ea8c4e93d04d425b64f5bb19
BLAKE2b-256 checksum
How to use checksums
e65a5b82c36a2e304d0c08b9e54456b9f7d05c637f64ec6746cb464e4d8db312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / inline_snapshot_pandas-0.2.0-py3-none-any.whl

Download URL inline_snapshot_pandas-0.2.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
575c59065a05b648667864e7dcf3f0104e0553d5cdd4f941c93f5de057392c21
BLAKE2b-256 checksum
How to use checksums
e75ca732bfa9032055a1286b9377e0417c28301c138db5b77bb127cc98dc2bfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page