README.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ==========
  2. Hypothesis
  3. ==========
  4. Hypothesis is an advanced testing library for Python. It lets you write tests which
  5. are parametrized by a source of examples, and then generates simple and comprehensible
  6. examples that make your tests fail. This lets you find more bugs in your code with less
  7. work.
  8. e.g.
  9. .. code-block:: python
  10. @given(st.lists(st.floats(allow_nan=False, allow_infinity=False), min_size=1))
  11. def test_mean(xs):
  12. assert min(xs) <= mean(xs) <= max(xs)
  13. .. code-block::
  14. Falsifying example: test_mean(
  15. xs=[1.7976321109618856e+308, 6.102390043022755e+303]
  16. )
  17. Hypothesis is extremely practical and advances the state of the art of
  18. unit testing by some way. It's easy to use, stable, and powerful. If
  19. you're not using Hypothesis to test your project then you're missing out.
  20. ------------------------
  21. Quick Start/Installation
  22. ------------------------
  23. If you just want to get started:
  24. .. code-block::
  25. pip install hypothesis
  26. -----------------
  27. Links of interest
  28. -----------------
  29. The main Hypothesis site is at `hypothesis.works <https://hypothesis.works/>`_, and contains a lot
  30. of good introductory and explanatory material.
  31. Extensive documentation and examples of usage are `available at readthedocs <https://hypothesis.readthedocs.io/en/latest/>`_.
  32. If you want to talk to people about using Hypothesis, `we have both an IRC channel
  33. and a mailing list <https://hypothesis.readthedocs.io/en/latest/community.html>`_.
  34. If you want to receive occasional updates about Hypothesis, including useful tips and tricks, there's a
  35. `TinyLetter mailing list to sign up for them <https://tinyletter.com/DRMacIver/>`_.
  36. If you want to contribute to Hypothesis, `instructions are here <https://github.com/HypothesisWorks/hypothesis-python/blob/master/CONTRIBUTING.rst>`_.
  37. If you want to hear from people who are already using Hypothesis, some of them `have written
  38. about it <https://hypothesis.readthedocs.io/en/latest/endorsements.html>`_.
  39. If you want to create a downstream package of Hypothesis, please read `these guidelines for packagers <https://hypothesis.readthedocs.io/en/latest/packaging.html>`_.