File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed
Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments