diff --git a/hypothesis-python/tests/cover/test_complex_numbers.py b/hypothesis-python/tests/cover/test_complex_numbers.py index 4af329d98e..b878b50cd3 100644 --- a/hypothesis-python/tests/cover/test_complex_numbers.py +++ b/hypothesis-python/tests/cover/test_complex_numbers.py @@ -26,7 +26,7 @@ def test_minimal(): - assert minimal(complex_numbers(), lambda x: True) == 0 + assert minimal(complex_numbers()) == 0 def test_minimal_nonzero_real(): @@ -80,17 +80,15 @@ def test_min_magnitude_respected(data, mag): def test_minimal_min_magnitude_zero(): - assert minimal(complex_numbers(min_magnitude=0), lambda x: True) == 0 + assert minimal(complex_numbers(min_magnitude=0)) == 0 def test_minimal_min_magnitude_positive(): - assert minimal(complex_numbers(min_magnitude=0.5), lambda x: True) in (0.5, 1) + assert minimal(complex_numbers(min_magnitude=0.5)) in (0.5, 1) def test_minimal_minmax_magnitude(): - assert minimal( - complex_numbers(min_magnitude=0.5, max_magnitude=1.5), lambda x: True - ) in (0.5, 1) + assert minimal(complex_numbers(min_magnitude=0.5, max_magnitude=1.5)) in (0.5, 1) @given(st.data(), st.floats(0, 10e300, allow_infinity=False, allow_nan=False)) diff --git a/hypothesis-python/tests/cover/test_composite.py b/hypothesis-python/tests/cover/test_composite.py index 43e823aeab..472515126f 100644 --- a/hypothesis-python/tests/cover/test_composite.py +++ b/hypothesis-python/tests/cover/test_composite.py @@ -34,8 +34,8 @@ def test_simplify_draws(): def test_can_pass_through_arguments(): - assert minimal(badly_draw_lists(5), lambda x: True) == [0] * 5 - assert minimal(badly_draw_lists(m=6), lambda x: True) == [0] * 6 + assert minimal(badly_draw_lists(5)) == [0] * 5 + assert minimal(badly_draw_lists(m=6)) == [0] * 6 @st.composite @@ -95,7 +95,7 @@ def test_can_use_pure_args(): def stuff(*args): return args[0](st.sampled_from(args[1:])) - assert minimal(stuff(1, 2, 3, 4, 5), lambda x: True) == 1 + assert minimal(stuff(1, 2, 3, 4, 5)) == 1 def test_composite_of_lists(): diff --git a/hypothesis-python/tests/cover/test_direct_strategies.py b/hypothesis-python/tests/cover/test_direct_strategies.py index be90ada4c2..05ef29078d 100644 --- a/hypothesis-python/tests/cover/test_direct_strategies.py +++ b/hypothesis-python/tests/cover/test_direct_strategies.py @@ -479,7 +479,7 @@ def test_iterables_are_exhaustible(it): def test_minimal_iterable(): - assert list(minimal(ds.iterables(ds.integers()), lambda x: True)) == [] + assert list(minimal(ds.iterables(ds.integers()))) == [] @pytest.mark.parametrize("parameter_name", ["min_value", "max_value"]) diff --git a/hypothesis-python/tests/cover/test_simple_characters.py b/hypothesis-python/tests/cover/test_simple_characters.py index 1410006a75..f6ee079b54 100644 --- a/hypothesis-python/tests/cover/test_simple_characters.py +++ b/hypothesis-python/tests/cover/test_simple_characters.py @@ -85,7 +85,7 @@ def test_exclude_characters_of_major_categories(): def test_find_one(): - char = minimal(characters(min_codepoint=48, max_codepoint=48), lambda _: True) + char = minimal(characters(min_codepoint=48, max_codepoint=48)) assert char == "0" @@ -138,7 +138,7 @@ def test_blacklisted_characters(): min_codepoint=ord("0"), max_codepoint=ord("9"), exclude_characters=bad_chars ) - assert "1" == minimal(st, lambda c: True) + assert "1" == minimal(st) assert_no_examples(st, lambda c: c in bad_chars) diff --git a/hypothesis-python/tests/cover/test_simple_collections.py b/hypothesis-python/tests/cover/test_simple_collections.py index b811f50c8c..f672a72eca 100644 --- a/hypothesis-python/tests/cover/test_simple_collections.py +++ b/hypothesis-python/tests/cover/test_simple_collections.py @@ -50,7 +50,7 @@ ], ) def test_find_empty_collection_gives_empty(col, strat): - assert minimal(strat, lambda x: True) == col + assert minimal(strat) == col @pytest.mark.parametrize( @@ -64,7 +64,7 @@ def test_find_non_empty_collection_gives_single_zero(coltype, strat): ("coltype", "strat"), [(list, lists), (set, sets), (frozenset, frozensets)] ) def test_minimizes_to_empty(coltype, strat): - assert minimal(strat(integers()), lambda x: True) == coltype() + assert minimal(strat(integers())) == coltype() def test_minimizes_list_of_lists(): @@ -96,12 +96,12 @@ def test_fixed_dictionaries_with_optional_and_empty_keys(d): @pytest.mark.parametrize("n", range(10)) def test_lists_of_fixed_length(n): - assert minimal(lists(integers(), min_size=n, max_size=n), lambda x: True) == [0] * n + assert minimal(lists(integers(), min_size=n, max_size=n)) == [0] * n @pytest.mark.parametrize("n", range(10)) def test_sets_of_fixed_length(n): - x = minimal(sets(integers(), min_size=n, max_size=n), lambda x: True) + x = minimal(sets(integers(), min_size=n, max_size=n)) assert len(x) == n if not n: @@ -113,9 +113,7 @@ def test_sets_of_fixed_length(n): @pytest.mark.parametrize("n", range(10)) def test_dictionaries_of_fixed_length(n): x = set( - minimal( - dictionaries(integers(), booleans(), min_size=n, max_size=n), lambda x: True - ).keys() + minimal(dictionaries(integers(), booleans(), min_size=n, max_size=n)).keys() ) if not n: @@ -168,9 +166,10 @@ def test_small_sized_sets(x): def test_minimize_dicts_with_incompatible_keys(): - assert minimal( - fixed_dictionaries({1: booleans(), "hi": lists(booleans())}), lambda x: True - ) == {1: False, "hi": []} + assert minimal(fixed_dictionaries({1: booleans(), "hi": lists(booleans())})) == { + 1: False, + "hi": [], + } @given( diff --git a/hypothesis-python/tests/nocover/test_find.py b/hypothesis-python/tests/nocover/test_find.py index 2fd6c9c3fb..2f566d44f8 100644 --- a/hypothesis-python/tests/nocover/test_find.py +++ b/hypothesis-python/tests/nocover/test_find.py @@ -20,7 +20,7 @@ def test_can_find_an_int(): - assert minimal(integers(), lambda x: True) == 0 + assert minimal(integers()) == 0 assert minimal(integers(), lambda x: x >= 13) == 13 diff --git a/hypothesis-python/tests/nocover/test_simple_numbers.py b/hypothesis-python/tests/nocover/test_simple_numbers.py index ee7d56f165..5bcc394975 100644 --- a/hypothesis-python/tests/nocover/test_simple_numbers.py +++ b/hypothesis-python/tests/nocover/test_simple_numbers.py @@ -58,7 +58,7 @@ def is_good(x): assert minimal(integers(min_value=boundary - 10), is_good) == boundary - assert minimal(integers(min_value=boundary), lambda x: True) == boundary + assert minimal(integers(min_value=boundary)) == boundary def test_minimizes_negative_integer_range_upwards(): @@ -67,11 +67,11 @@ def test_minimizes_negative_integer_range_upwards(): @boundaries def test_minimizes_integer_range_to_boundary(boundary): - assert minimal(integers(boundary, boundary + 100), lambda x: True) == boundary + assert minimal(integers(boundary, boundary + 100)) == boundary def test_single_integer_range_is_range(): - assert minimal(integers(1, 1), lambda x: True) == 1 + assert minimal(integers(1, 1)) == 1 def test_minimal_small_number_in_large_range(): @@ -97,11 +97,11 @@ def test_minimal_non_boundary_float(): def test_minimal_float_is_zero(): - assert minimal(floats(), lambda x: True) == 0.0 + assert minimal(floats()) == 0.0 def test_minimal_asymetric_bounded_float(): - assert minimal(floats(min_value=1.1, max_value=1.6), lambda x: True) == 1.5 + assert minimal(floats(min_value=1.1, max_value=1.6)) == 1.5 def test_negative_floats_simplify_to_zero(): @@ -176,8 +176,8 @@ def test_in_range(r): def test_bounds_are_respected(): - assert minimal(floats(min_value=1.0), lambda x: True) == 1.0 - assert minimal(floats(max_value=-1.0), lambda x: True) == -1.0 + assert minimal(floats(min_value=1.0)) == 1.0 + assert minimal(floats(max_value=-1.0)) == -1.0 @pytest.mark.parametrize("k", range(10))