So I'm trying to compare two implementations of a function with Hypothesis to determine if they work the same way with a huge variety of different inputs that I might not think of myself.
I tried using numpy.testing.assert_allclose
to compare the outputs, but Hypothesis just repeatedly outsmarts it. The more I widen the acceptable tolerance, the larger values Hypothesis throws at it until it fails, even though the outputs are similar enough to be considered the same.
E Not equal to tolerance rtol=0.1, atol=0.001
...
Falsifying example: test_resample_1d_consistency(a=array([7.696582e+12, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00], dtype=float32), num=11)
E Not equal to tolerance rtol=0.1, atol=0.01
...
Falsifying example: test_resample_1d_consistency(a=array([7.366831e+13, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00], dtype=float32), num=11)
E Not equal to tolerance rtol=1000, atol=1000
...
Falsifying example: test_resample_1d_consistency(a=array([8.360933e+18, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00], dtype=float32), num=186)
etc.
So I guess I need a different "good enough" test of similarity, or I need to limit the input value range in some way? But I'm not sure how to do these in a way that won't miss genuinely wrong answers. Any advice?