It doesn't assert the result, and yes, it does raise an error, which is what we wanted to find. However, I'm not suggesting you replace the initial test. I'm suggesting you complement it to find this kind of error.

If you want to assert anything with hypothesis, you can of course. In this case, you could assert something like, "this function returns positive and negative floats." Or you could take the inverse again a second time and the input should equal the output.

Hi !

The problem with your code with Hypothesis is that you don't check anymore with assertions if the code is valid.

@given(

st.integers()

)

def test_inverse_of_hypothesis(value):

inverse_of(value)

This only triggers an error but it does not check the result anymore.

Thanks for your article.

You're correct!

It doesn't assert the result, and yes, it does raise an error, which is what we wanted to find. However, I'm not suggesting you replace the initial test. I'm suggesting you complement it to find this kind of error.

If you want to assert anything with hypothesis, you can of course. In this case, you could assert something like, "this function returns positive and negative floats." Or you could take the inverse again a second time and the input should equal the output.