File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,40 @@ the unittest module!
190190 `py.test <https://docs.pytest.org/en/latest/ >`_
191191
192192
193+ Hypothesis
194+ ----------
195+
196+ Hypothesis is a library which lets you write tests that are parametrized by
197+ a source of examples. It then generates simple and comprehensible examples
198+ that make your tests fail, letting you find more bugs with less work.
199+
200+ .. code-block :: console
201+
202+ $ pip install hypothesis
203+
204+ For example, testing lists of floats will try many examples, but report the
205+ minimal example of each bug (distinguished exception type and location):
206+
207+ .. code-block :: python
208+
209+ @given (lists(floats(allow_nan = False , allow_infinity = False ), min_size = 1 ))
210+ def test_mean (xs ):
211+ mean = sum (xs) / len (xs)
212+ assert min (xs) <= mean(xs) <= max (xs)
213+
214+ .. code-block ::
215+
216+ Falsifying example: test_mean(
217+ xs=[1.7976321109618856e+308, 6.102390043022755e+303]
218+ )
219+
220+ Hypothesis is practical as well as very powerful, and will often find bugs
221+ that escaped all other forms of testing. It integrates well with py.test,
222+ and has a strong focus on usability in both simple and advanced scenarios.
223+
224+ `hypothesis <https://hypothesis.readthedocs.io/en/latest/ >`_
225+
226+
193227tox
194228---
195229
You can’t perform that action at this time.
0 commit comments