Skip to content

Commit 4ab820e

Browse files
committed
shrink example again
1 parent 6121992 commit 4ab820e

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

hypothesis-python/docs/index.rst

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,12 @@ Hypothesis is the property-based testing library for Python. With Hypothesis, yo
4949
5050
from hypothesis import given, strategies as st
5151
52-
@given(st.lists(st.integers() | st.floats(allow_nan=False)))
53-
def test_sort_correct(lst):
54-
# We can check if the result is correct without a trusted reference:
52+
@given(st.lists(st.integers() | st.floats()))
53+
def test_sort_correctness_using_properties(lst):
5554
result = my_sort(lst)
56-
assert set(lst) == set(result) # or collections.Counter
55+
assert set(lst) == set(result)
5756
assert all(a <= b for a, b in zip(result, result[1:]))
5857
59-
@given(
60-
st.recursive(
61-
st.from_type(None | bool | int | float | str),
62-
lambda elem: st.lists(elem) | st.dictionaries(st.text(), elem),
63-
)
64-
)
65-
def test_json_roundtrip(value):
66-
assume(value == value) # exclude e.g. NaN
67-
assert value == json.loads(json.dumps(value))
68-
6958
You should start with the :doc:`tutorial <tutorial/index>`, or alternatively the more condensed :doc:`quickstart <quickstart>`.
7059

7160
.. rst-class:: row

0 commit comments

Comments
 (0)