Code Monkey home page Code Monkey logo

minithesis's Introduction

Minithesis

This is is an incredibly minimal implementation of the core idea of Hypothesis, mostly intended for demonstration purposes to show someone how they might get the basics of it up and running.

Minithesis supports:

  • Generating arbitrary values inline in the test, including based on previous test results
  • Fully generic shrinking
  • Preconditions
  • A test database
  • Targeted Property-Based Testing

And it achieves this all in a relatively small amount of code - my original goal was to keep it under 1000 sloc, but then I implemented about twice the feature set I'd intended to and it didn't hit 300 sloc, so I doubt I'll come close to that (including comments, docstrings, etc. it might eventually hit 1kloc as I try to make it more easily understandable and more thoroughly explained)

Notes

  • The algorithms for both shrinking and targeting are a bit naive but they're not terrible - they should be good enough that using them is better than not having them.
  • The database uses Python's DBM module for simplicity.
  • This is probably best read after or in tandem with our paper about test-case reduction in Hypothesis
  • This does not necessarily track the core Hypothesis implementation that closely and is more an "in spirit" implementation.
  • This probably doesn't work all that well - it's tolerably well tested, but nobody has ever used it for real and probably nobody ever will because why would they when Hypothesis exists?
  • Pull requests to improve clarity extremely welcome. It probably won't ever grow many features (I might implement the database at some point) though because you're not supposed to use it in anger.
  • I've used the (sadly defunct) Hypothesis-for-Ruby naming conventions because those are better than the Python ones because I actually put some thought into them.
  • There is a fairly minimal generator library just to get you started but it's nothing resembling comprehensive and is unlikely to ever be.

Minithesis Ports

There are a number of ports of minithesis (:tada:). The following are the ones I'm aware of:

If you write a port, please submit a pull request to add it to the list!

minithesis's People

Contributors

drmaciver avatar gvanrossum avatar kejadlen avatar anoctopus avatar jackfirth avatar

Watchers

 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.