![Build Status](https://secure.travis-ci.org/vmalloc/dessert.png)
![Version](https://img.shields.io/pypi/v/dessert.svg)
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](http://pytest.org ), and all credit is due to Holger Krekel and the pytest developers for this code.
Usage
=====
Using dessert is fairly simple:
```python
>>> 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/vmalloc/dessert",
"name": "dessert",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5.*",
"maintainer_email": "",
"keywords": "",
"author": "Rotem Yaari",
"author_email": "vmalloc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3a/7e/ac9ca6cea471a6767fbbdbf4a743e1ec953117a97c583105129a760f364d/dessert-1.4.4.tar.gz",
"platform": null,
"description": "![Build Status](https://secure.travis-ci.org/vmalloc/dessert.png)\n![Version](https://img.shields.io/pypi/v/dessert.svg)\n\nOverview\n========\n\nDessert is a utility library enabling Python code to introspect assertions raised via the `assert` statement.\n\nIt is a standalone version of the introspection code from [pytest](http://pytest.org ), and all credit is due to Holger Krekel and the pytest developers for this code.\n\nUsage\n=====\n\nUsing dessert is fairly simple:\n\n```python\n\n>>> with open(tmp_filename, \"w\") as f:\n... _ = f.write(\"\"\"\n... def func():\n... def x():\n... return 1\n... def y():\n... return -1\n... assert y() == x()\n... \"\"\")\n\n>>> import emport\n>>> import dessert\n>>> with dessert.rewrite_assertions_context():\n... module = emport.import_file(tmp_filename)\n>>> module.func() # doctest: +IGNORE_EXCEPTION_DETAIL +ELLIPSIS\nTraceback (most recent call last):\n ...\n assert y() == x()\nAssertionError: assert -1 == 1\n+ where -1 = <function y at ...>()\n+ and 1 = <function x at ...>()\n```\n\nLicence\n=======\n\nDessert is released under the MIT license. It is 99% based on pytest, which is released under the MIT license.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Assertion introspection via AST rewriting",
"version": "1.4.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "add8d530de2bb8a88730ba9397c0836c",
"sha256": "2561e2b0a158b98d53ff4d9df4ce172c96e3da608bf20fa75b5656cda4b260d8"
},
"downloads": -1,
"filename": "dessert-1.4.4.tar.gz",
"has_sig": false,
"md5_digest": "add8d530de2bb8a88730ba9397c0836c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5.*",
"size": 152145,
"upload_time": "2022-08-02T14:52:09",
"upload_time_iso_8601": "2022-08-02T14:52:09.007329Z",
"url": "https://files.pythonhosted.org/packages/3a/7e/ac9ca6cea471a6767fbbdbf4a743e1ec953117a97c583105129a760f364d/dessert-1.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-08-02 14:52:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "vmalloc",
"github_project": "dessert",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "munch",
"specs": []
},
{
"name": "py",
"specs": []
},
{
"name": "atomicwrites",
"specs": [
[
">=",
"1.0"
]
]
},
{
"name": "attrs",
"specs": []
}
],
"test_requirements": [
{
"name": "pytest",
"specs": []
},
{
"name": "emport",
"specs": [
[
">=",
"1.1.1"
]
]
}
],
"tox": true,
"lcname": "dessert"
}