golden master/snapshot/approval testing library which puts the values right into your source code
Project description
inline-snapshot
create and update inline snapshots in your code.
Installation
You can install "inline-snapshot" via pip:
pip install inline-snapshot
Usage
You can use snapshot()
instead of the value which you want to compare with.
from inline_snapshot import snapshot
def test_something():
assert 1548 * 18489 == snapshot()
You can now run the tests and record the correct values.
$ pytest --inline-snapshot=create
from inline_snapshot import snapshot
def test_something():
assert 1548 * 18489 == snapshot(28620972)
Features
- manage snapshots with
pytest --inline-snapshot=(create,update,fix,trim)
. - uses
repr()
to convert the value to python code. - values are stored in the source code and not in separate files.
snapshot()
supports the following operations:x == snapshot()
x <= snapshot()
x >= snapshot()
x in snapshot()
snapshot()[key]
- code is formatted with black if the file was already formatted with black.
More information can be found in the documentation.
Contributing
Contributions are very welcome. Tests can be run with nox. Please use pre-commit for your commits.
License
Distributed under the terms of the MIT license, "inline-snapshot" is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
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
File details
Details for the file inline_snapshot-0.2.0.tar.gz
.
File metadata
- Download URL: inline_snapshot-0.2.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.0 Linux/5.10.0-23-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dde0ab0f6bab5f2e0776133cc419ac4d2899c1ba228b2629ba7c327a9dfde8f7 |
|
MD5 | 06c8ac3e6db39764bbdae6d1a5814a09 |
|
BLAKE2b-256 | b439e7e9b6529a00ac69824eb9c297650c211d456cab65df4033d30461885e53 |
File details
Details for the file inline_snapshot-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: inline_snapshot-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.0 Linux/5.10.0-23-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae70510b164f1b36a82e7f604a89661ff35905059f12804ee62dd93dfbdca538 |
|
MD5 | 8d710cd523fa462a2fccf430dafec99f |
|
BLAKE2b-256 | a88603f1ec1815c5f7c03be532d8bb61f624a5b04d53e0ddc36635b8f1ad7ac7 |