Git Product home page Git Product logo

dessert's Introduction

Build Status Version

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.

dessert's People

Contributors

hpk42 avatar nicoddemus avatar ronnypfannschmidt avatar benjaminp avatar flub avatar the-compiler avatar bubenkoff avatar vmalloc avatar hackebrot avatar pfctdayelise avatar turbo87 avatar msabramo avatar jurko-gospodnetic avatar michaelaquilina avatar palaviv avatar tomviner avatar omarkohl avatar takluyver avatar blueyed avatar kalekundert avatar carreau avatar avdn avatar kvas-it avatar hartym avatar sallner avatar pedronis avatar elizaveta239 avatar mbyt avatar schmir avatar ionelmc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.