The logical implication (a => b) The second argument has to be a function. It will be lazily evaluated if needed. (not a) or b """ if a: return f() else: return True my_falsify("replace if", lambda x, y, z: replace_if(x, y, z) == (z if x in y else x), int, [int], str) def replace_if_prop(x, y, z): return replace_if(x, y, z) == (z if x in y else x) my_falsify("replace if2", replace_if_prop, int, [int], str) my_falsify("replace alternating", lambda ss, ts, rs: for_all_not_in(ts, replace_alternating(ss, ts, rs), rs), [str], [str], [str]) my_falsify("cycle1", lambda x: (not x) or (get_from_gen(cycle(x), 0) == get_from_gen(cycle(x), len(x))),
def replace_if_prop(x, y, z): return replace_if(x, y, z) == (z if x in y else x)
def test_replace_if(x, y, z): assert replace_if(x, y, z) == (z if x in y else x)