HYPOTHESIS(1)
β¨ HYPOTHESIS β¨
okay bestie sit DOWN because this one is genuinely so useful π the hypothesis command is a helper tool for property-based testing β like, it literally writes and maintains your property-based tests for you in your Python project. no cap. π¦
πΈ SYNOPSIS πΈ
hypothesis codemod PATH
hypothesis write [OPTIONS] FUNCTION [FUNCTION ...]
π DESCRIPTION π
So here's the tea: hypothesis helps you write and maintain property-based tests in your Python project. Two whole modes, both iconic. π
π§ hypothesis codemod
This one refactors deprecated or inefficient code, and it rewrites your files in place. Yes, in place. Right there. Where you live. π«Ά It has no additional options β it's just built different, no knobs to fiddle with, periodt.
π hypothesis write
This is the main character. It writes property-based tests for you. Type annotations are helpful but not required (she's flexible like that π ). Here's every option she recognizes:
--roundtripβ writes roundtrip tests for write/read or encode/decode functions. like, you know, does the thing survive the trip back? π
Example: hypothesis write --roundtrip json.dumps json.loads
--equivalentβ writes tests checking whether two functions behave identically. twin energy fr fr. π―
Example: hypothesis write --equivalent ast.literal_eval eval
--errors-equivalentβ same vibe as--equivalent, but it also allows consistent errors. so if both of them blow up the same way? that counts. π--idempotentβ writes tests checking whether a function is idempotent. do it once, do it a hundred times, same result bestie. β¨--binary-opβ writes tests for associativity, commutativity and identitiy element. (yes, the manpage says "identitiy" β we keep the lore intact. π) the math girlies are gonna eat this up.
Example: hypothesis write --binary-op operator.add
--except CLASSβ dotted name of an exception to ignore. can be specified multiple times. stack 'em up. π--annotate,--no-annotateβ forces tests to be type-annotated (or NOT). pick your fighter. π--style=STYLEβ writes tests as pytest functions or unittest methods. your aesthetic, your call. π
π AUTHORS π
hypothesis was conceived by David R. McIver and written with the help of many contributors. this manual page was written by Timo RΓΆhling for Debian, and may be reused without restriction. slay of them honestly. πΈ
~ this has been your girl, signing off on version 6.155.7 ~ go write some tests, bestie, you're gonna ate ππ¦β¨ππ
π¦ where this page comes from
- ubuntu stonking: python3-hypothesis 6.155.7-1 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms