It looks like you asked this question as two parts on the Hypothesis issue tracker - thanks for moving it over here as suggested :-) Porting my answer over too for posterity:
The key insight here is that you can call a Hypothesis-wrapped function like any other, and have the inner function save its inputs. For example:
counterexample = None
@given(x=st.integers())
def check(f, g, x):
if f(x) != g(x):
global counterexample
counterexample = x
raise AssertionError
with contextlib.suppress(AssertionError):
check(f=math.sin, g=math.cos)
assert counterexample is not None
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…