This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


inputgen is a Python package that provides automated input generation, useful for bounded exhaustive testing and the generation of complex data structures for test inputs.

This tool was originally created as a class project—Verification and Validation of Software with professor Sarfraz Khurshid—and is largely modeled after Korat and its related research. Korat is an input generation tool for Java programs.

Official documentation, other than this readme, is currently lacking; however, the associated class paper provides a detailed description the implementation and related research.


  • Uses multiple processes to speed input generation.

  • Search space pruning:

    • Backtracking - The generated objects are instrumented to record the order of their field accesses, which occurs while checking the well-formedness of their structure in the defined predicate. Upon rejection of an input combination, alternative values are first tried on the last-accessed field(s).

      This feature is enabled by default, and can be disabled by setting enable_backtracking=False when instantiating a Factory object.

    • Non-isomorphic generation - Only objects with unique structure are generated. Two inputs are isomorphic, or identical in structure, if their object graphs reachable from the root object are isomorphic.

      For example, if building a binary tree of size two, using five possible node objects, then there are only two possible valid, non-isomorphic structures—a root node and left child, or a root node and right child.

      This feature is enabled by default, and can be disabled by setting enable_iso_breaking=False when instantiating a Factory object.

Requirements and Installation

inputgen requires Python 2.5 or later. If using Python 2.6, inputgen will install and make use of the stand-alone ordereddict package. If using Python 2.5, inputgen will additionally install and make use of the stand-alone multiprocessing package.

To install inputgen and required dependencies, run:

pip install inputgen

The source can be found here:


Below is a simple example. For more examples, see the inputgen/examples/ directory.

Given the following code:

import inputgen

class SquareTest(inputgen.TestCase):

    def repOK(factory):
        return True

    def fin(min=0, max=10):
        f = inputgen.Factory(enable_backtracking=False,
        f.set('number', range(min, max))
        return f

    def run_method(self, factory):
        num = factory.number
        self.assertEqual(num * num, num ** 2)

if __name__ == "__main__":
    import unittest

Save the code to a file named and then run the unit test:


When run, inputgen will generate all possible combinations of the finitized fields. In the example above this will produce ten combinations, with a single field (number) ranging from 0 to 9.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
inputgen-0.7.1.tar.gz (224.8 kB) Copy SHA256 Checksum SHA256 Source Jul 12, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting