Unchanged
A simple approvals/snapshot/golden master library that lets you configure your testing tools any way you want.
Features
- Sensible defaults: Just want to do some basic snapshot on most Python objects? Go for it. Snapshot testing should be easy.
- Highly Modular: Want to do fuzzy comparison, pre-check file scrubbing, have the diff display in a non-Python program, and use the latest test runner? No problem, plug your tools and functions into
unchangedbased on your own preferences and project needs. - No External Dependencies:
unchanged's internals are stupidly simple, using only the Python standard library--you decide what packages your tests will rely on, not us.
Installation
pip install unchanged
Example Usage
from unchanged import verify
Hello world is still "Hello world"
from unchanged import verify
verify("Hello, world", path="greeting.txt")
Use Git Diff to Compare files
With subprocess:
from unchanged import Verifier
from subprocess import Popen
verify = Verifier(show_diffs=lambda f1, f2: Popen(['git' ,'diff', '--no-index', f1, f2]))
verify("Hello, world", path='greeting.txt')
With the unchanged.Program utility:
from unchanged import Verifier, Program
verify = Verifier(show_diffs=Program(['git' ,'diff', '--no-index']))
verity("Hello world")
Use NBDime to Compare Jupyter Notebooks
from unchanged import Verifier
from subprocess import Popen
notebooks_match = lambda f1, f2: Popen(['nbdime', 'diff', '--ignore-metadata', f1, f2]).stdout.read() == ''
show_notebook_diff = lambda f1, f2: Popen(['nbdime', 'diff-web'])
verify_notebook = Verifier(show_diffs=Program(['nbdime', 'diff-web']), files_match=notebooks_match)
Use BeyondCompare 3 to Display Diffs
from unchanged import Verifier
from subprocess import Popen
path_to_bc3 = "{ProgramFiles}/Beyond Compare 4/BCompare.exe"
show_diff_in_BC3 = lambda f1, f2: Popen([path_to_bc3])
verify = Verifier(show_diffs=show_diff_in_BC3)
Check Matplotlib Plots, Displaying Diffs in VSCode
from unchanged import Verifier
from subprocess import Popen
Metadata
Release files for unchanged 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unchanged-0.2.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unchanged-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / unchanged-0.2.tar.gz
| Download URL | unchanged-0.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa9b83df15acbae8b08140d2ab732743ba5b234d28e6de48756eccc7098504a2
|
|
BLAKE2b-256 checksum How to use checksums |
a27844b32cf80025420b764667ae1fa3ef640b52f0bb6685f7bd99949405593b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / unchanged-0.2-py3-none-any.whl
| Download URL | unchanged-0.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c28053bb34c4501b2e828caefbfae6225051d3f8fa5e799e404e85bdd27ae821
|
|
BLAKE2b-256 checksum How to use checksums |
a65c8fddf416d60669cc739891995b63a2b74cbc42e5500b1a207034d7a8f78c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|