hypothesis

Generate test inputs and shrink failing examples for Python property tests.

118|10|Updated Oct 13, 2025
One-click install
npx skills add https://github.com/anam-org/metaxy --skill hypothesis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hypothesis
Source: https://github.com/anam-org/metaxy/tree/main/.claude/skills/hypothesis
Command: npx skills add https://github.com/anam-org/metaxy --skill hypothesis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hypothesis automates the generation of diverse test inputs and shrinking of failing cases to help you find and fix edge cases quickly, improving test coverage and reliability.

Core Features & Use Cases

  • Property-based testing to systematically explore input spaces and verify invariants
  • Stateful testing with rule-based state machines
  • Pytest integration; Polars integration enables dataframe-oriented property tests

Quick Start

Install Hypothesis and start writing tests using given strategies to automatically generate inputs and verify properties. For example, test that a function preserves invariants across a broad input space, or create composite strategies to build structured inputs for your code.

Frequently Asked Questions about hypothesis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is property-based testing and how does it find edge cases in Python?

Property-based testing systematically explores broad input spaces to verify invariants, rather than checking specific examples. It automatically generates diverse test inputs and shrinks failing cases to reveal hidden edge cases quickly.

How do I generate test inputs automatically with pytest?

You can generate test inputs automatically with pytest by using the Hypothesis library. Define strategies that specify the input data shapes, and Hypothesis will generate diverse values to run against your test functions.

Can I use property-based testing for data validation with Polars dataframes?

Yes, Polars integration enables dataframe-oriented property tests for data validation. You can generate complex dataframe structures as test inputs to systematically verify that your data transformations preserve required invariants.

How does stateful testing with rule-based state machines work?

Stateful testing models a system as a rule-based state machine, generating sequences of operations to verify invariants across multiple state transitions. This approach uncovers bugs in complex stateful systems by exploring varied interaction paths.

What is the best way to shrink failing test cases in Python?

The best way to shrink failing test cases is using Hypothesis, which automatically minimizes failing inputs to their simplest form. This reduces complex bugs to minimal examples, making them easy to understand and fix.

Do I need to write manual test cases when using property-based testing?

No, property-based testing replaces manual test case writing with automated input generation. Instead of handcrafting individual examples, you define strategies that generate comprehensive inputs to validate code properties automatically.