Assertion introspection via AST rewriting
Project description
Overview
Dessert is a utility library enabling Python code to introspect assertions raised via the assert statement.
It is a standalone version of the introspection code from pytest, and all credit is due to Holger Krekel and the pytest developers for this code.
Usage
Using dessert is fairly simple:
>>> with open(tmp_filename, "w") as f:
... _ = f.write("""
... def func():
... def x():
... return 1
... def y():
... return -1
... assert y() == x()
... """)
>>> import emport
>>> import dessert
>>> with dessert.rewrite_assertions_context():
... module = emport.import_file(tmp_filename)
>>> module.func() # doctest: +IGNORE_EXCEPTION_DETAIL +ELLIPSIS
Traceback (most recent call last):
...
assert y() == x()
AssertionError: assert -1 == 1
+ where -1 = <function y at ...>()
+ and 1 = <function x at ...>()
Licence
Dessert is released under the MIT license. It is 99% based on pytest, which is released under the MIT license.
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 dessert-1.6.3.tar.gz.
File metadata
- Download URL: dessert-1.6.3.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3113bd5bca112e99a968dcf74afe8841c4e370a936ebeec61b8d9dfb91b8ef6
|
|
| MD5 |
ead879a8fc7d67521dcbf4e078da51e0
|
|
| BLAKE2b-256 |
ea58d3e1f91d91e180b567c4cb9bf5a1208c1432b85a9abd8a8de91cae52633c
|
Provenance
The following attestation bundles were made for dessert-1.6.3.tar.gz:
Publisher:
main.yml on getslash/dessert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dessert-1.6.3.tar.gz -
Subject digest:
a3113bd5bca112e99a968dcf74afe8841c4e370a936ebeec61b8d9dfb91b8ef6 - Sigstore transparency entry: 719597374
- Sigstore integration time:
-
Permalink:
getslash/dessert@900f1866fe6a0977a33d9d88c6a205dc84bc1778 -
Branch / Tag:
refs/tags/1.6.3 - Owner: https://github.com/getslash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@900f1866fe6a0977a33d9d88c6a205dc84bc1778 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dessert-1.6.3-py3-none-any.whl.
File metadata
- Download URL: dessert-1.6.3-py3-none-any.whl
- Upload date:
- Size: 21.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 |
512a32e3f19235a117c49ccf27b86f49a90a527320e4ba7fa99f23de45307151
|
|
| MD5 |
a0fc2301fc3ad9f14b01457d0b83a0fc
|
|
| BLAKE2b-256 |
6fd4d9476deed63bd421976ea5466a00c7ee0dbf342ea7283a3357fa08c620b0
|
Provenance
The following attestation bundles were made for dessert-1.6.3-py3-none-any.whl:
Publisher:
main.yml on getslash/dessert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dessert-1.6.3-py3-none-any.whl -
Subject digest:
512a32e3f19235a117c49ccf27b86f49a90a527320e4ba7fa99f23de45307151 - Sigstore transparency entry: 719597383
- Sigstore integration time:
-
Permalink:
getslash/dessert@900f1866fe6a0977a33d9d88c6a205dc84bc1778 -
Branch / Tag:
refs/tags/1.6.3 - Owner: https://github.com/getslash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@900f1866fe6a0977a33d9d88c6a205dc84bc1778 -
Trigger Event:
push
-
Statement type: