hypothesis(1)

hypothesis1

Helper tool for property-based testing

Usage

hypothesis codemod PATH

hypothesis write [OPTIONS] FUNCTION [FUNCTION ...]

Overview

hypothesis helps you write and maintain property-based tests in your Python project.

hypothesis codemod refactors deprecated or inefficient code, rewriting files in place. It has no additional options.

hypothesis write writes property-based tests for you. Type annotations are helpful but not required. The following options are recognized:

--roundtrip

write roundtrip tests for write/read or encode/decode functions.

Example: hypothesis write --roundtrip json.dumps json.loads

--equivalent

write tests whether two functions behave identically.

Example: hypothesis write --equivalent ast.literal_eval eval

--errors-equivalent

like --equivalent, but also allows consistent errors.

--idempotent

write tests whether a function is idempotent.

--binary-op

write tests for associativity, commutativity and identitiy element.

Example: hypothesis write --binary-op operator.add

--except CLASS

dotted name of exception to ignore. can be specified multiple times.

--annotate, --no-annotate

force tests to be type-annotated (or not).

--style=STYLE

write tests as pytest functions or unittest methods.

Authors

hypothesis has been conceived by David R. McIver and written with the help of many contributors.

This manual page has been written by Timo Röhling ⟨[email protected]⟩ for Debian and may be reused without restriction.

From python3-hypothesis 6.130.5-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.